我如何制作一个可以指出链接的discord机器人?

2024-04-19 13:33:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在尝试制作一个discord bot,它将删除discord服务器邀请,但我不知道如何制作,以便bot知道链接是什么,这是我迄今为止尝试的:

import discord
from discord.ext import commands

client = commands.Bot(command_prefix = "https://discord.") #This along with the 'def gg' is trying to specify a discord invite
@client.event
async def on_ready():
    print('Its working')

@client.command()
async def gg(ctx):
    #I need this to find out if it is a link

client.run('(Token)')

如果你有一个更有效的解决方案,我很乐意阅读


Tags: tofromimport服务器clientasyncis链接
1条回答
网友
1楼 · 发布于 2024-04-19 13:33:56

如果使用^{}事件,则可以轻松找到服务器邀请链接。以这种方式使用bot前缀不是一种好的方法。另外,请注意,即使是超链接,discord仍将嵌入邀请,因此discord.gg/invite_code仍将显示嵌入,即使discord不会将其标记为超链接

相关问题 更多 >