top gg python

Solutions on MaxInterview for top gg python by the best coders in the world

showing results for - "top gg python"
Justine
22 Oct 2019
1from discord.ext import commands
2
3import dbl
4
5
6class TopGG(commands.Cog):
7    """
8    This example uses dblpy's webhook system.
9    In order to run the webhook, at least webhook_port must be specified (number between 1024 and 49151).
10    """
11
12    def __init__(self, bot):
13        self.bot = bot
14        self.token = 'dbl_token'  # set this to your DBL token
15        self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
16
17    @commands.Cog.listener()
18    async def on_dbl_vote(self, data):
19        """An event that is called whenever someone votes for the bot on top.gg."""
20        print("Received an upvote:", "\n", data, sep="")
21
22    @commands.Cog.listener()
23    async def on_dbl_test(self, data):
24        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""
25        print("Received a test upvote:", "\n", data, sep="")
26
27
28def setup(bot):
29    bot.add_cog(TopGG(bot))