GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 89480e...6fa725 )
by Git
03:23
created

extras.setup()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
import discord
2
from discord.ext import commands
3
import variables as var
4
from functions import get_prefix
5
import database as db
6
7
8
class Extras(commands.Cog):
9
    def __init__(self, bot):
10
        self.bot = bot
11
12
    @commands.command()
13
    async def ping(self, ctx):
14
        await ctx.send(
15
            f"Pong 🏓! Response time: {round(self.bot.latency * 1000)}ms"
16
        )
17
18
    @commands.command(aliases=["userinfo"])
19
    async def user(self, ctx, user:discord.User=None):
20
        if not user:
21
            user = ctx.author
22
23
        embed = discord.Embed(
24
            title=f"{user} info",
25
            color=var.C_MAIN
26
        )
27
        embed.set_thumbnail(url=user.avatar.url)
28
        embed.add_field(name="ID", value=user.id, inline=False)
29
        embed.add_field(name="Account created", value=user.created_at.strftime("%B %d, %Y"), inline=False)
30
        embed.add_field(name="Bot", value=user.bot, inline=False)
31
        await ctx.send(embed=embed)
32
33
    @commands.command(aliases=["memberinfo"])
34
    async def member(self, ctx, member:discord.Member=None):
35
        if not member:
36
            member = ctx.author
37
38
        if member.status == discord.Status.online:
39
            status = "<:online:313956277808005120>"
40
        elif member.status == discord.Status.idle:
41
            status = "<:away:313956277220802560>"
42
        elif member.status == discord.Status.dnd:
43
            status = "<:dnd:313956276893646850>"
44
        elif member.status == discord.Status.offline:
45
            status = "<:offline:313956277237710868>"
46
        else:
47
            status = "<:invisible:313956277107556352>"
48
49
        embed = discord.Embed(
50
            title=f"{member} info",
51
            description=status,
52
            color=var.C_MAIN
53
        )
54
        embed.set_thumbnail(url=member.avatar.url)
55
        embed.add_field(
56
            name="Roles",
57
            value=" ".join(role.mention for role in member.roles
58
        ), inline=False)
59
        embed.add_field(name="Nickname", value=member.nick, inline=False)
60
        embed.add_field(name="Status", value=member.status, inline=False)
61
        embed.add_field(name="Joined at", value=member.joined_at.strftime("%B %d, %Y"), inline=False)
62
        embed.add_field(name="ID", value=member.id, inline=False)
63
        await ctx.send(embed=embed)
64
65
    @commands.command()
66
    async def source(self, ctx):
67
        embed = discord.Embed(
68
            title="My Github Source Code Woohoo",
69
            description="[GitBolt - Axiol](https://github.com/GitBolt/Axiol)",
70
            color=var.C_TEAL
71
        ).set_thumbnail(
72
            url=(
73
                "https://cdn0.iconfinder.com/data/"
74
                "icons/shift-logotypes/32/Github-512.png"
75
            )
76
        )
77
        await ctx.send(embed=embed)
78
79
    @commands.command()
80
    async def invite(self, ctx):
81
        embed = discord.Embed(
82
            title="My invite link!",
83
            description=(
84
                "[Invite me from here](https://discord.com/oauth2/authorize"
85
                "?client_id=843484459113775114&permissions=473295959&scope=bot)"
86
            ),
87
            color=var.C_BLUE
88
        ).set_thumbnail(
89
            url=(
90
                "https://cdn.discordapp.com/attachments/843519647055609856/"
91
                "845662999686414336/Logo1.png"
92
            )
93
        )
94
95
        await ctx.send(embed=embed)
96
97
    @commands.command()
98
    async def suggest(self, ctx, *, desc=None):
99
        if desc is not None:
100
            # Support server suggestion channel
101
            channel = self.bot.get_channel(843548616505294848)
102
103
            embed = discord.Embed(
104
                title=f"{ctx.author}'s idea",
105
                description=(
106
                    f"This idea came from a server named **{ctx.guild.name}**!"
107
                ),
108
                color=var.C_BLUE
109
            ).add_field(
110
                name="Suggestion", value=desc
111
            )
112
113
            msg = await channel.send(embed=embed)
114
            await msg.add_reaction(var.E_ACCEPT)
115
            await msg.add_reaction(var.E_DECLINE)
116
            await ctx.send("Suggestion sent to the support server!")
117
118
        else:
119
            await ctx.send(
120
                f"You need to describe your idea too! This is the format\n"
121
                f"```{await get_prefix(ctx)} <description of your idea>```\n"
122
                f"Don't forget the space after prefix :D"
123
            )
124
125
    @commands.command(aliases=["bot", "info"])
126
    async def about(self, ctx):
127
        guild_count = 0
128
        member_count = 0
129
        ping = f"{round(self.bot.latency * 1000)}ms"
130
131
        for guild in self.bot.guilds:
132
            guild_count += 1
133
            member_count += guild.member_count
134
135
        embed = discord.Embed(
136
            title="Some information about me :flushed:",
137
            description=(
138
                f"[Donation](https://paypal.me/palbolt) "
139
                f"[Vote](https://top.gg/bot/843484459113775114/vote) "
140
                f"[Support](https://discord.gg/Rzz5WS9jXW)"
141
            ),
142
            color=var.C_MAIN
143
        ).add_field(
144
            name="Server Count",
145
            value=str(guild_count),
146
            inline=False
147
        ).add_field(
148
            name="Members",
149
            value=member_count,
150
            inline=False
151
        ).add_field(
152
            name="Made by",
153
            value="Bolt#8905",
154
            inline=False
155
        ).add_field(
156
            name="Creation date",
157
            value="16 May, 2021",
158
            inline=False
159
        ).set_footer(
160
            text=f"Ping: {ping}"
161
        ).set_thumbnail(
162
            url=(
163
                "https://cdn.discordapp.com/attachments/843519647055609856/"
164
                "845662999686414336/Logo1.png"
165
            )
166
        )
167
168
        await ctx.send(embed=embed)
169
170
    @commands.command()
171
    async def stats(self, ctx):
172
        embed = discord.Embed(
173
            title=f"{ctx.guild.name}",
174
            color=var.C_TEAL
175
        )
176
177
        embed.add_field(name="Owner", value=ctx.guild.owner, inline=False)
178
        embed.add_field(
179
            name="All Members", value=ctx.guild.member_count, inline=False
180
        )
181
182
        embed.add_field(
183
            name="Channels", value=str(len(ctx.guild.channels)), inline=False
184
        )
185
186
        embed.add_field(
187
            name="Voice Channels",
188
            value=str(len(ctx.guild.voice_channels)),
189
            inline=False
190
        )
191
192
        embed.add_field(
193
            name="Roles", value=str(len(ctx.guild.roles)), inline=False
194
        )
195
196
        embed.add_field(
197
            name="Boost Level", value=ctx.guild.premium_tier, inline=False
198
        )
199
200
        embed.add_field(
201
            name="Created at",
202
            value=str(ctx.guild.created_at.strftime("%Y - %m - %d")),
203
            inline=False
204
        )
205
206
        embed.set_thumbnail(url=ctx.guild.icon.url)
207
208
        guild_verify_doc = await db.VERIFY.find_one({"_id": ctx.guild.id})
209
        if guild_verify_doc is not None:
210
            role = ctx.guild.get_role(guild_verify_doc.get("roleid"))
211
212
            count = sum(role in member.roles for member in ctx.guild.members)
213
            embed.add_field(name="Non Verified Members", value=str(count))
214
215
        await ctx.send(embed=embed)
216
217
218
def setup(bot):
219
    bot.add_cog(Extras(bot))
220