示例#1
0
class Info(commands.Cog):
    """
This Module allows you to get data about this bot.
    """
    def __init__(self, bot):
        self._original_help_command = bot.help_command
        bot.help_command = EmbedHelpCommand()
        bot.help_command.cog = self
        self.bot = bot
        self.icon = "<:tubes:715934865794662501>"
        self.thumbnail = 'https://media.discordapp.net/attachments/693832161660370945/715936504651972728/lab.png?width=499&height=499'
        self.helping = Helping()
        self.global_check = False

    @commands.command(description="Displays the average webstock latency.")
    async def ping(self, ctx):
        """
        Displays the average webstock latency.
        """
        lst = []
        for i in range(3):
            lst.append(round(self.bot.latency * 1000))

        embed = discord.Embed(title="PONG", color=0x36393E)
        embed.add_field(name=f"Average websocket latency",
                        value=f":ping_pong: | `{lst[0]}ms`",
                        inline=False)
        embed.set_footer(icon_url=ctx.author.avatar_url_as(format="png"),
                         text=self.helping.get_footer(ctx))
        await ctx.send(embed=embed)
示例#2
0
class Events(commands.Cog):

    def __init__(self, bot):
        self.bot = bot
        self.log_color = 0xb94b4b
        self.helping = Helping()


    # @tasks.loop(seconds=30)w
    # async def change_status(self):
    #     if ctx.guild.premium_subscribers == self.bot.prem_lst:
    #         return
    #     elif ctx.guild.premium_subscribers != self.bot.prem_lst:
    #         for user in ctx.guild.premium_subscribers:
    #             if user not in self.bot.prem_lst:
    #                 channel = ctx.guild.get_channel(716939038489051136)
    #                 await channel.send('new premium man')

    @commands.Cog.listener()
    async def on_ready(self):

        await self.bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"The Universal Union"))

        print('Logged in as')
        print(self.bot.user.name)
        print(self.bot.user.id)
        print('------')

        # self.change_status.start()
        # self.change_statuss.start()


    @commands.Cog.listener()
    async def on_message_delete(self, message):
        channel = self.bot.get_channel(735524706656190525)
        embed=discord.Embed(color=self.log_color)
        if message.attachments:
            # embed.set_image(url=f"{message.attachments[0].url}")
            content="**{Image}**"
        else:
            content = message.content
        embed.description=f"**[NEW-MESSAGE-DELETE]**\n\n`Message-author`: {message.author.name}, {message.author.id}\n`Channel`: {message.channel.mention},\n`Message`: {content}"
        embed.set_footer(text=self.helping.get_footer(message))
        await channel.send(embed=embed)