2
votes

I am using the discord webhook api to send messages to my discord servers channels. In a new use case I want to create a new channel with a webhook. Unfortunately I could not find any API to do so. I read through the whole documentation here: https://discordapp.com/developers/docs/resources/webhook#create-webhook

Is this even possible to do? I saw methods for a discord bot that allowed it - therefore I kinda think it should be possible with a webhook, too.

1

1 Answers

0
votes

I think the Discord webhooks are only for sending messages and nothing more and you'll probably have to use a bot to create the channel if you don't want to do it manually.

Creating a webhook via discord.py API is only supported on the rewrite branch I think

Installing discord.py-rewrite pip install git+https://github.com/Rapptz/discord.py@rewrite

import discord
from discord.ext.commands import Bot
bot=Bot(command_prefix='.')

@bot.event
async def on_ready():
    print(bot.user.name)


@bot.command()
async def chan(msg):
    chan=await msg.guild.create_text_channel(name='New text')
    web=await chan.create_webhook(name='New web')
    print(web.url)

bot.run("YOUr bot token here")

you can find the documentation here and you can create your bot here