コード例 #1
0
    async def _prefix(self, ctx):
        """SHOWS THE SERVER PREFIX """
        bot_requests(ctx.message, str(ctx.command), self.bot.db)

        embed = discord.Embed(title="Every prefix you can use on this server:",
                              description=f", \n".join(
                                  self.prefix(str(ctx.guild.id))))
        return await ctx.send(embed=embed)
コード例 #2
0
    async def _db_addfield(self, ctx, *, field_name: str, type):
        """CREATE A NEW FIELD IN THE DATABASE"""
        bot_requests(ctx.message, str(ctx.command), self.bot.db)

        types = {"list": [], "object": {}, "string": "", "int": int}
        self.bot.db.update_one({"_id": str(ctx.guild.id)},
                               {"$set": {
                                   field_name: types[type]
                               }})
コード例 #3
0
    async def _plot_mentions(self, ctx):
        bot_requests(ctx.message, str(ctx.command), self.bot.db)

        data = self.data["message"]
        CSV(self.server_id, data).create_csv("message")
        create_plot("mentions", str(ctx.guild.id))
        img = discord.File(f"./src/img/{str(ctx.guild.id)}_mentions.png")
        await ctx.trigger_typing()
        return await ctx.send(file=img)
コード例 #4
0
ファイル: stats.py プロジェクト: Bmbus/DiscordAnalytica
    async def _stats(self, ctx):
        """Get general stats of the server

        This command can only be used on a server
        """
        bot_requests(ctx.message, str(ctx.command), self.bot.db)
        data = self.bot.db.find_one({"_id": str(ctx.guild.id)})

        embed = Embed(title=f"{ctx.guild.name} ~ general stats",
                      timestamp=datetime.utcnow())
        embed.add_field(name="Total messages send:*",
                        value=f"{len(data['message'])}",
                        inline=False)
        embed.add_field(name="Total reactions added:*",
                        value=f"{len(data['reaction'])}",
                        inline=False)
        embed.add_field(name="Total bot requests:*",
                        value=f"{len(data['bot_requests'])}",
                        inline=False)
        embed.add_field(name="Total user-joins:*",
                        value=f"{len(data['userjoins'])}",
                        inline=False)
        embed.add_field(name="Total user-leaves:*",
                        value=f"{len(data['userleave'])}",
                        inline=False)
        embed.add_field(name="Total mentions:*",
                        value=f"{len(data['mentions'])}",
                        inline=False)
        embed.add_field(name="Total bot messages:*",
                        value=f"{len(data['bot_msg'])}",
                        inline=False)
        embed.set_footer(
            text=f"Since I joined the server: {data['server_join']}",
            icon_url=self.bot.user.avatar_url)

        return await ctx.send(embed=embed)