【发布时间】:2020-07-25 01:17:26
【问题描述】:
所以我试图让嵌入消息在不同的文本通道之间传输,有三个选项。 “已修复”-“非错误”-“未修复”。 discord 服务器的管理员会根据 bug 的情况选择这三个中的一个。
问题是,当我对这些表情之一做出反应时,它会发送有关消息的信息,如下所示:
<Message id=735831838555242557 channel=<TextChannel id=733721953134837861 name='admin-bug' position=4 nsfw=False news=False category_id=733717942604398684> type=<MessageType.default: 0> author=<Member id=733720584831369236 name='ReefCraft' discriminator='3102' bot=True nick=None guild=<Guild id=733717942604398682 name="Pumbalo's server" shard_id=None chunked=True member_count=2>> flags=<MessageFlags value=0>>
我需要它来发送嵌入,所以不是那个^^它应该是这样的:
这是我的python代码:
import discord
from discord.ext import commands
import asyncio
TOKEN = '---'
bot = commands.Bot(command_prefix='!!')
emojis = ["\u2705", "\U0001F6AB", "\u274C"]
emojis2 = ["\u2705", "\u274C"]
@bot.event
async def on_ready():
print('Bot is ready.')
@bot.command()
async def bug(ctx, desc=None, rep=None):
user = ctx.author
await ctx.author.send('```Please explain the bug```')
responseDesc = await bot.wait_for('message', check=lambda message: message.author == ctx.author, timeout=300)
description = responseDesc.content
await ctx.author.send('```Please provide pictures/videos of this bug```')
responseRep = await bot.wait_for('message', check=lambda message: message.author == ctx.author, timeout=300)
replicate = responseRep.content
embed = discord.Embed(title='Bug Report', color=0x00ff00)
embed.add_field(name='Description', value=description, inline=False)
embed.add_field(name='Replicate', value=replicate, inline=True)
embed.add_field(name='Reported By', value=user, inline=True)
adminBug = bot.get_channel(733721953134837861)
message = await adminBug.send(embed=embed)
# Add 3 reaction (different emojis) here
for emoji in emojis:
await message.add_reaction(emoji)
@bot.event
async def on_reaction_add(reaction, user):
message = reaction.message
emoji = reaction.emoji
if user.bot:
return
if emoji == "\u2705":
fixed_channel = bot.get_channel(733722567449509958)
await fixed_channel.send(message)
elif emoji == "\U0001F6AB":
notBug = bot.get_channel(733722584801083502)
await notBug.send(message)
elif emoji == "\u274C":
notFixed = bot.get_channel(733722600706146324)
await notFixed.send(message)
else:
return
bot.run(TOKEN)
我以前得到过一些帮助,但我从来没有得到过帮助。
【问题讨论】:
-
首先,您刚刚公开了您的令牌。确保立即重新生成一个新的。
-
我认为您上一个问题中的my answer 解决了您的问题?
-
一开始确实有效,但又添加了一些东西,无法让它发挥作用。
标签: python python-3.x discord.py discord.py-rewrite