Bases: Cog
Class that holds general commands about the bot or server
Hosts commands such as server info.
This class extends commands.Cog
from discord.
Parameters: |
-
bot
–
-
logger
–
Logger object for logging purposes
|
Attributes: |
-
bot
–
-
logger
–
Logger object for logging purposes
-
hidden
(
bool )
–
Attribute that determines if this list of
command should show in the help command or not.
If false , will show in help.
-
__cog_name__
(
str )
–
Command designation for the help command
|
Source code in /Users/caoma/Documents/Programming/GIT/SkyWizz/skywizz/cogs/general_commands.py
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 | class GeneralCommands(commands.Cog):
"""
Class that holds general commands about the bot or server
Hosts commands such as server info.
This class extends `commands.Cog` from discord.
Args:
bot: Discord API client
logger: Logger object for logging purposes
Attributes:
bot: Discord API client
logger: Logger object for logging purposes
hidden (bool): Attribute that determines if this list of
command should show in the help command or not.
If `false`, will show in help.
__cog_name__ (str): Command designation for the help command
"""
def __init__(self, bot, logger):
self.bot = bot
self.logger = logger
self.hidden = False
self.__cog_name__ = "General Commands"
self.logger.info(f"Loaded {self.__cog_name__}")
@commands.cooldown(2, 30, commands.BucketType.user)
@commands.command(name='server')
async def server_info(self, ctx):
"""
Command that shows details about the current server
Usage:
`!server`
"""
embed = embd.newembed(title=f"{ctx.guild.name} Info",
description="Information of this Server")
embed.add_field(name='ℹ️Server ID', value=f"{ctx.guild.id}",
inline=True)
embed.add_field(name='📆Created On',
value=ctx.guild.created_at.strftime("%b %d %Y"),
inline=True)
embed.add_field(name='👑Owner', value=f"{ctx.guild.owner.mention}",
inline=True)
embed.add_field(name='👥Members',
value=f'{ctx.guild.member_count} Members',
inline=False)
embed.add_field(name='💬Channels',
value=f'{len(ctx.guild.text_channels)} Text | '
f'{len(ctx.guild.voice_channels)} Voice',
inline=False)
await ctx.send(embed=embed)
|
server_info(ctx)
async
Command that shows details about the current server
Usage
!server
/Users/caoma/Documents/Programming/GIT/SkyWizz/skywizz/cogs/general_commands.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 | @commands.cooldown(2, 30, commands.BucketType.user)
@commands.command(name='server')
async def server_info(self, ctx):
"""
Command that shows details about the current server
Usage:
`!server`
"""
embed = embd.newembed(title=f"{ctx.guild.name} Info",
description="Information of this Server")
embed.add_field(name='ℹ️Server ID', value=f"{ctx.guild.id}",
inline=True)
embed.add_field(name='📆Created On',
value=ctx.guild.created_at.strftime("%b %d %Y"),
inline=True)
embed.add_field(name='👑Owner', value=f"{ctx.guild.owner.mention}",
inline=True)
embed.add_field(name='👥Members',
value=f'{ctx.guild.member_count} Members',
inline=False)
embed.add_field(name='💬Channels',
value=f'{len(ctx.guild.text_channels)} Text | '
f'{len(ctx.guild.voice_channels)} Voice',
inline=False)
await ctx.send(embed=embed)
|