Skip to main content
edited tags; edited title
Link
Mast
  • 13.8k
  • 12
  • 57
  • 127

Entire discordDiscord bot

Tweeted twitter.com/StackCodeReview/status/1364772119096283144
Reflect github update
Source Link
Joyte
  • 135
  • 6
# 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)
# 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)
# 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 = bump.get_top(raw=True)

                    if oldtop is None:
                        firstbump = True
                        oldtop = 0

                    bump.add_total()
                    newtop = 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)
Reflect github update
Source Link
Joyte
  • 135
  • 6
# 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

        counting =if Counting(message.guild.id)
        if counting.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)
# 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

        counting = Counting(message.guild.id)
        if counting.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)
# 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)
Ooops.
Source Link
ferada
  • 11.4k
  • 26
  • 65
Loading
Source Link
Joyte
  • 135
  • 6
Loading