minor optimizations to handle_message
@@ -11,6 +11,13 @@ cdef tuple BAD_ARG_ERRORS = (
cdef list IGNORED_ERRORS = [commands.CommandNotFound, commands.NotOwner]
+cdef set NITRO_BOOST_MSGS = {
+ discord.MessageType.premium_guild_subscription,
+ discord.MessageType.premium_guild_tier_1,
+ discord.MessageType.premium_guild_tier_2,
+ discord.MessageType.premium_guild_tier_3,
+}
+
cpdef tuple handle_error(self: object, ctx: object, e: BaseException):
if isinstance(e, commands.NoPrivateMessage):
return (self.bot.send(ctx, ctx.l.misc.errors.private),)
@@ -71,12 +78,7 @@ cpdef tuple handle_message(self: object, m: object):
if m.guild is not None:
if m.guild.id == self.d.support_server_id:
- if m.type in (
- discord.MessageType.premium_guild_subscription,
- discord.MessageType.premium_guild_tier_1,
- discord.MessageType.premium_guild_tier_2,
- discord.MessageType.premium_guild_tier_3,
- ):
+ if m.type in NITRO_BOOST_MSGS:
return (
self.db.add_item(m.author.id, "Barrel", 1024, 1),
self.bot.send(m.author, f"Thanks for boosting the support server! You've received 1x **Barrel**!"),
