【发布时间】:2021-03-10 16:41:34
【问题描述】:
我已经编写了一个用于提供建议和帮助的机器人。
我想在嵌入的footer 中添加作者标签和头像。但是我没有找到任何可以帮助我解决问题的好资源。
这是我的方法:
import discord
from discord.ext import commands
import datetime
bot = commands.Bot(command_prefix='*')
suggest_channel = None
class hollow(commands.Cog):
def init(self, bot):
self.bot = bot
@commands.Cog.listener("on_message")
async def deletion(self,message):
if message.channel.id == (799202156771147796):
if message.author.id == (811243366795837***):
return
else:
await message.delete()
embed = discord.Embed(
title=f'Sugestie',
description=(message.content),
color = discord.Color.blue()
)
embed.set_footer(
text=f'id:{message.author.id}')
embed.timestamp= datetime.datetime.utcnow()
x = await message.channel.send(embed = embed)
await x.add_reaction(':white_check_mark:')
await x.add_reaction(':x:')
elif message.channel.id == (799202157404356638):
if message.author.id == (811243366795837***):
return
else:
await message.delete()
embed = discord.Embed(
title=f'Help requested by:{message.author}',
description=(message.content),
color = discord.Color.blue()
)
embed.set_footer(
text=f'id:{message.author.id}')
embed.timestamp= datetime.datetime.utcnow()
await message.channel.send(embed = embed)
def setup(bot):
bot.add_cog(hollow(bot))
另外,对于不和谐的反应,我如何将这个表情符号放入代码中?
✅
【问题讨论】:
标签: python discord discord.py