Hi I'm trying to get a member name rather than the author name
I've tried a few methods like for member is message.server.members:
which returned multiple results with every member in the server and tried member: discord.Member
as a signature which produced an error:
Heres what I'm working with:
async def on_message_delete(self, message):
server = message.server
author = message.author
role = get(server.roles, name="Powerbot")
channel = get(message.server.channels, name="mod-log")
time = datetime.utcnow()
cleanmsg = message.content
for i in message.mentions:
cleanmsg = cleanmsg.replace(i.mention, str(i))
fmt = '%H:%M:%S'
name = author
name = " ~ ".join((name.name, name.nick)) if name.nick else name.name
if role not in author.roles:
infomessage = "A message by {}, was deleted in {} by {}".format(message.author.mention, message.channel.mention, member,mention)
delmessage = discord.Embed(description=infomessage, colour=discord.Color.purple(), timestamp=time)
delmessage.add_field(name="Message:", value=cleanmsg)
delmessage.set_footer(text="User ID: {}".format(message.author.id))
delmessage.set_author(name=name + " message deleted.", icon_url=message.author.avatar_url)
delmessage.set_thumbnail(url="http://i.imgur.com/fJpAFgN.png")
try:
await self.bot.send_message(channel, embed=delmessage)
except:
pass
The line specifically where member.mention is.
infomessage = "A message by {}, was deleted in {} by {}".format(message.author.mention, message.channel.mention, member.mention)
Example output: A message by author was deleted in channel by member.
If anyone could help that would be appreciated.