print(f'{bot.user} has connected to Discord!') # 定义一个命令来发送消息到指定频道 @bot.command() async def send_message(ctx, channel_id: int, *, message): # 获取频道对象 channel = bot.get_channel(channel_id) if not channel: await ctx.send("无法找到指定的频道。") return # 发送消...
python discord discord.py async def sendmessage(ctx, channelID=None, content=None): if channelID == None: print("ERROR: NSB01") else: await bot.get_channel(channelID).send(content) 似乎无法向其他服务器/公会中的频道发送消息。。。bot同时存在于两台服务器中(用户发出命令的服务器和目标通道所...
向特定通道discord.py发送消息时出错 、、 我在Discord.py上制作了一个机器人,并尝试使用参数设置要发送消息的通道。async def send(ctx, arg1): await channel.send('Message') 当我键入通道id而不是发送时,它可以工作,但当我在不一致(!arg1 282772187812)上键入命令时,它不起作用,并且我得到这个错 浏览0提...
请确保将YOUR_DISCORD_TOKEN替换为你在步骤2中获取到的Discord应用的令牌,并将TARGET_CHANNEL_ID替换为你想要发送消息的目标频道的ID。 运行代码:在命令行中,使用以下命令运行你的代码: 运行代码:在命令行中,使用以下命令运行你的代码: 如果一切顺利,你的Discord机器人将连接到服务器,并在收到!hello消息时发送“Hel...
to execute the script first async def dm(ctx): rand_num = (randint(1, 3)) win_num = 1 if rand_num == win_num: print("number was:", rand_num) print("won") @client.event async def on_win(): dmessage.send.user("You won!") #Send the won result message via direct message ...
Discord is a proprietary freeware voice-over-Internet Protocol (VoIP) application designed for video gaming communities, that specializes in text, image, video, and audio communication between users in a chat channel. Here are 665 public repositories matching this topic... Language: All Sort: ...
@client.event async def on_message(message): if message.content == "test": guild = discord.Guild user = guild.guild.get_member(user_id = the id from a user) await message.channel.send(user) discord.py Share Improve this question Follow edited Jun 25, 2020 at 17:04 asked Jun...
bot.py", line 877, in cmd_bootybomb await self.send_message(discord.Object(id = userid), bootybomb) File "C:\Users\pc\AppData\Local\Programs\Python\Python35\lib\site-packages\discord\client.py", line 831, in send_message data = yield from self.http.send_message(channel_id, content,...
dockermirrorsynchronizertelegram-channeldiscord-channel UpdatedFeb 13, 2021 Python A simple database which uses a Discord channel to store data. databasediscorddiscord-pydiscord-channel UpdatedNov 22, 2020 Python Discord channel banners for The Slimy Swamp's Discord server!
Channel ID channel_id string The channel id this webhook is for, if any. user user User Name name string The default name of the webhook. Avatar avatar string The default user avatar hash of the webhook. Token token string The secure token of the webhook (returned for Incoming Webhook...