Skip to content

Conversation

@retr0-init
Copy link
Contributor

Pull Request Type

  • Feature addition
  • Bugfix
  • Documentation update
  • Code refactor
  • Tests improvement
  • CI/CD pipeline enhancement
  • Other: [Replace with a description]

Description

Webhook support for Forum channel itself is missing. i.e.:

channel: GuildForum = ctx.guild.get_channel(FORUM_CHANNEL_ID)
await channel.create_webhook("test")

Changes

Class GuildForum now also inherits class WebhookMixin.

Related Issues

N/A

Test Scenarios

  1. Create a Forum channel if there is not one.
  2. Register a function like below:
@interactions.slash_command(
    "test1", description="test channel command", scopes=[DEV_GUILD] if DEV_GUILD else None
)
@interactions.slash_option(
    name="channel",
    description="Channel",
    opt_type=interactions.OptionType.CHANNEL,
    required=True
)
async def test_cmd(self, ctx: interactions.SlashContext, channel: interactions.GuildForum):
    """Register as an extension command"""
    await ctx.send(f"Test Create a webhook in channel {channel.mention}")
    await channel.create_webhook(f"{channel.name}WBT")
  1. Run this command in guild and you can see a webhook is created.

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x

Checklist

  • I've run the pre-commit code linter over all edited files
  • I've tested my changes on supported Python versions
  • I've added tests for my code, if applicable
  • I've updated / added documentation, where applicable

@silasary silasary merged commit de71f4c into interactions-py:unstable Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants