使用python创建Discord Webhook
使用python创建Discord Webhook 我最近正在用python开发一个discord机器人。我的discord机器人需要通过它发送消息 “不和谐网钩”。问题是我找不到一种方法来使用python自动创建一个不协调的webhook!有没有办法做到这一点使用python创建Discord Webhook,python,discord,discord.py,webhooks,discord.py-rewrite,Python,Discord,Discord.py,Webhooks,Discord.py Rewrite,使用python创建Discord Webhook 我最近正在用python开发一个discord机器人。我的discord机器人需要通过它发送消息 “不和谐网钩”。问题是我找不到一种方法来使用python自动创建一个不协调的webhook!有没有办法做到这一点 import discord client = discord.Client() @client.event async def on_message(message): if message.content == 'creat
import discord
client = discord.Client()
@client.event
async def on_message(message):
if message.content == 'createhook':
#code to create a webhook in that current channel
client.run("token")
您需要一个discord.TextChannel
对象。在您的情况下,您可以使用
message.channel
获取消息对象的频道
要创建webhook,您需要执行message.channel.create\u webhook(name=“mywebhook”)
您需要一个discord.TextChannel
对象。在您的情况下,您可以使用
message.channel
获取消息对象的频道
要创建webhook,您需要执行message.channel.create\u webhook(name=“mywebhook”)