mirror of
https://github.com/brandons209/Red-bot-Cogs.git
synced 2024-06-01 10:09:36 +12:00
add reply to activity log, minor change to birthday embed
This commit is contained in:
parent
e56c87274f
commit
7a7f853ccc
|
@ -30,9 +30,18 @@ TIMESTAMP_FORMAT = "%Y-%m-%d %X" # YYYY-MM-DD HH:MM:SS
|
||||||
AUTHOR_TEMPLATE = "@{0.author.name}#{0.author.discriminator}(id:{0.author.id})"
|
AUTHOR_TEMPLATE = "@{0.author.name}#{0.author.discriminator}(id:{0.author.id})"
|
||||||
MESSAGE_TEMPLATE = AUTHOR_TEMPLATE + ": {0.clean_content}"
|
MESSAGE_TEMPLATE = AUTHOR_TEMPLATE + ": {0.clean_content}"
|
||||||
|
|
||||||
|
# 0 is Message object, 1 is the message replied too
|
||||||
|
REPLY_TEMPLATE = (
|
||||||
|
AUTHOR_TEMPLATE
|
||||||
|
+ " replied to @{1.author.name}#{1.author.discriminator}(id:{1.author.id}): {1.clean_content} [with]: {0.clean_content}"
|
||||||
|
)
|
||||||
|
|
||||||
# 0 is Message object, 1 is attachment URL
|
# 0 is Message object, 1 is attachment URL
|
||||||
ATTACHMENT_TEMPLATE = AUTHOR_TEMPLATE + ": {0.clean_content} (attachment url(s): {1})"
|
ATTACHMENT_TEMPLATE = AUTHOR_TEMPLATE + ": {0.clean_content} (attachment url(s): {1})"
|
||||||
|
|
||||||
|
# 0 is Message object, 1 is sticker URL
|
||||||
|
STICKER_TEMPLATE = AUTHOR_TEMPLATE + ": {0.clean_content} (sticker url(s): {1})"
|
||||||
|
|
||||||
# 0 is Message object, 1 is attachment path
|
# 0 is Message object, 1 is attachment path
|
||||||
DOWNLOAD_TEMPLATE = AUTHOR_TEMPLATE + ": {0.clean_content} (attachment(s) saved to {1})"
|
DOWNLOAD_TEMPLATE = AUTHOR_TEMPLATE + ": {0.clean_content} (attachment(s) saved to {1})"
|
||||||
|
|
||||||
|
@ -88,6 +97,8 @@ class ActivityLogger(commands.Cog):
|
||||||
h.close()
|
h.close()
|
||||||
|
|
||||||
async def initialize(self):
|
async def initialize(self):
|
||||||
|
await self.bot.wait_until_ready()
|
||||||
|
|
||||||
guild_data = await self.config.all_guilds()
|
guild_data = await self.config.all_guilds()
|
||||||
channel_data = await self.config.all_channels()
|
channel_data = await self.config.all_channels()
|
||||||
self.cache = await self.config.attrs()
|
self.cache = await self.config.attrs()
|
||||||
|
@ -1333,6 +1344,16 @@ class ActivityLogger(commands.Cog):
|
||||||
elif message.attachments:
|
elif message.attachments:
|
||||||
urls = ",".join(a.url for a in message.attachments)
|
urls = ",".join(a.url for a in message.attachments)
|
||||||
entry = ATTACHMENT_TEMPLATE.format(message, urls)
|
entry = ATTACHMENT_TEMPLATE.format(message, urls)
|
||||||
|
else:
|
||||||
|
if message.reference:
|
||||||
|
ref_channel = message.guild.get_channel(message.reference.channel_id)
|
||||||
|
ref_message = None
|
||||||
|
if ref_channel:
|
||||||
|
ref_message = await ref_channel.fetch_message(message.reference.message_id)
|
||||||
|
if ref_message:
|
||||||
|
entry = REPLY_TEMPLATE.format(message, ref_message)
|
||||||
|
else:
|
||||||
|
entry = MESSAGE_TEMPLATE.format(message)
|
||||||
else:
|
else:
|
||||||
entry = MESSAGE_TEMPLATE.format(message)
|
entry = MESSAGE_TEMPLATE.format(message)
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ class Birthday(commands.Cog):
|
||||||
embed.description = f"{member.mention} is now **{age} years old!**"
|
embed.description = f"{member.mention} is now **{age} years old!**"
|
||||||
else:
|
else:
|
||||||
embed.description = f"Happy Birthday to {member.mention}!"
|
embed.description = f"Happy Birthday to {member.mention}!"
|
||||||
|
embed.set_footer("Add your birthday using the `bday` command!")
|
||||||
try:
|
try:
|
||||||
await channel.send(embed=embed, allowed_mentions=discord.AllowedMentions.all())
|
await channel.send(embed=embed, allowed_mentions=discord.AllowedMentions.all())
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue