Browse Source

Add system_content for thread message types, fix other system_content issues

pull/7297/head
Lilly Rose Berner 4 years ago
committed by GitHub
parent
commit
a053f77275
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 47
      discord/message.py

47
discord/message.py

@ -994,21 +994,27 @@ class Message(Hashable):
if self.type is MessageType.default: if self.type is MessageType.default:
return self.content return self.content
if self.type is MessageType.pins_add:
return f'{self.author.name} pinned a message to this channel.'
if self.type is MessageType.recipient_add: if self.type is MessageType.recipient_add:
return f'{self.author.name} added {self.mentions[0].name} to the group.' if self.channel.type is ChannelType.group:
return f'{self.author.name} added {self.mentions[0].name} to the group.'
else:
return f'{self.author.name} added {self.mentions[0].name} to the thread.'
if self.type is MessageType.recipient_remove: if self.type is MessageType.recipient_remove:
return f'{self.author.name} removed {self.mentions[0].name} from the group.' if self.channel.type is ChannelType.group:
return f'{self.author.name} removed {self.mentions[0].name} from the group.'
else:
return f'{self.author.name} removed {self.mentions[0].name} from the thread.'
if self.type is MessageType.channel_name_change: if self.type is MessageType.channel_name_change:
return f'{self.author.name} changed the channel name: {self.content}' return f'{self.author.name} changed the channel name: **{self.content}**'
if self.type is MessageType.channel_icon_change: if self.type is MessageType.channel_icon_change:
return f'{self.author.name} changed the channel icon.' return f'{self.author.name} changed the channel icon.'
if self.type is MessageType.pins_add:
return f'{self.author.name} pinned a message to this channel.'
if self.type is MessageType.new_member: if self.type is MessageType.new_member:
formats = [ formats = [
"{0} joined the party.", "{0} joined the party.",
@ -1030,16 +1036,28 @@ class Message(Hashable):
return formats[created_at_ms % len(formats)].format(self.author.name) return formats[created_at_ms % len(formats)].format(self.author.name)
if self.type is MessageType.premium_guild_subscription: if self.type is MessageType.premium_guild_subscription:
return f'{self.author.name} just boosted the server!' if not self.content:
return f'{self.author.name} just boosted the server!'
else:
return f'{self.author.name} just boosted the server **{self.content}** times!'
if self.type is MessageType.premium_guild_tier_1: if self.type is MessageType.premium_guild_tier_1:
return f'{self.author.name} just boosted the server! {self.guild} has achieved **Level 1!**' if not self.content:
return f'{self.author.name} just boosted the server! {self.guild} has achieved **Level 1!**'
else:
return f'{self.author.name} just boosted the server **{self.content}** times! {self.guild} has achieved **Level 1!**'
if self.type is MessageType.premium_guild_tier_2: if self.type is MessageType.premium_guild_tier_2:
return f'{self.author.name} just boosted the server! {self.guild} has achieved **Level 2!**' if not self.content:
return f'{self.author.name} just boosted the server! {self.guild} has achieved **Level 2!**'
else:
return f'{self.author.name} just boosted the server **{self.content}** times! {self.guild} has achieved **Level 2!**'
if self.type is MessageType.premium_guild_tier_3: if self.type is MessageType.premium_guild_tier_3:
return f'{self.author.name} just boosted the server! {self.guild} has achieved **Level 3!**' if not self.content:
return f'{self.author.name} just boosted the server! {self.guild} has achieved **Level 3!**'
else:
return f'{self.author.name} just boosted the server **{self.content}** times! {self.guild} has achieved **Level 3!**'
if self.type is MessageType.channel_follow_add: if self.type is MessageType.channel_follow_add:
return f'{self.author.name} has added {self.content} to this channel' return f'{self.author.name} has added {self.content} to this channel'
@ -1059,9 +1077,18 @@ class Message(Hashable):
if self.type is MessageType.guild_discovery_grace_period_final_warning: if self.type is MessageType.guild_discovery_grace_period_final_warning:
return 'This server has failed Discovery activity requirements for 3 weeks in a row. If this server fails for 1 more week, it will be removed from Discovery.' return 'This server has failed Discovery activity requirements for 3 weeks in a row. If this server fails for 1 more week, it will be removed from Discovery.'
if self.type is MessageType.thread_created:
return f'{self.author.name} started a thread: **{self.content}**. See all **threads**.'
if self.type is MessageType.reply: if self.type is MessageType.reply:
return self.content return self.content
if self.type is MessageType.thread_starter_message:
if self.reference is None or self.reference.resolved is None:
return 'Sorry, we couldn\'t load the first message in this thread'
return self.reference.resolved.content # type: ignore
if self.type is MessageType.guild_invite_reminder: if self.type is MessageType.guild_invite_reminder:
return 'Wondering who to invite?\nStart by inviting anyone who can help you build the server!' return 'Wondering who to invite?\nStart by inviting anyone who can help you build the server!'

Loading…
Cancel
Save