# JoyBot/cogs/bump.py
@commands.Cog.listener()
async def on_message(self, message):
try:
if Ban(message.guild.id).is_banned():
return
except AttributeError:
return
if Counting(message.guild.id).channel_get_id() == message.channel.id:
return
firstbump = False
if message.author.id == config['DISBOARDID']:
for embed in message.embeds:
if ":thumbsup:" in embed.description:
bumpID = await get_id().member(embed.description)
bump = Bmp(message.guild.id, bumpID)
oldtop = str(bump.get_top(raw=True))
if oldtop is None:
firstbump = True
oldtop = 0
bump.add_total()
newtop = str(bump.get_top(raw=True))
send_msg = f"<@{bumpID}>, your bump total has been increased by one!\nType `.bumptotal` to view your current bump total!"
if not firstbump:
if oldtop != newtop:
send_msg += "\nYou also managed to get the top spot! Nice!"
send_msg += f"\n\n<@{oldtop}>, you've lost your top spot!"
else:
send_msg += "\n\nYou were also the first to bump the server. Congrats!"
await message.channel.send(send_msg)