|
|
@ -16,8 +16,9 @@ class GetInfo(commands.Cog):
|
|
|
|
|
|
|
|
|
|
|
|
# ~userinfo to allow the users to see information about them relating to the guild
|
|
|
|
# ~userinfo to allow the users to see information about them relating to the guild
|
|
|
|
@command(name="userinfo", aliases=["ui"])
|
|
|
|
@command(name="userinfo", aliases=["ui"])
|
|
|
|
@cooldown(1, 1, BucketType.user)
|
|
|
|
@cooldown(1, 5, BucketType.user)
|
|
|
|
async def user_info(self, ctx, target: Optional[Member]):
|
|
|
|
async def user_info(self, ctx, target: Optional[Member]):
|
|
|
|
|
|
|
|
|
|
|
|
# If a target has been specified, set them as the user
|
|
|
|
# If a target has been specified, set them as the user
|
|
|
|
if target:
|
|
|
|
if target:
|
|
|
|
target = target
|
|
|
|
target = target
|
|
|
@ -82,53 +83,50 @@ class GetInfo(commands.Cog):
|
|
|
|
# Send the embed to the channel that the command was triggered in
|
|
|
|
# Send the embed to the channel that the command was triggered in
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ~serverinfo to allow the users to see information the guild itself
|
|
|
|
@command(name="serverinfo", aliases=["guildinfo"])
|
|
|
|
@command(name="serverinfo", aliases=["guildinfo"])
|
|
|
|
@cooldown(1, 1, BucketType.user)
|
|
|
|
@cooldown(1, 5, BucketType.user)
|
|
|
|
async def server_info(self, ctx):
|
|
|
|
async def server_info(self, ctx):
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
# Define guild icon and id
|
|
|
|
# Define guild icon and id
|
|
|
|
guild_icon = ctx.guild.icon_url
|
|
|
|
guild_icon = ctx.guild.icon_url
|
|
|
|
guild_id = ctx.guild.id
|
|
|
|
guild_id = ctx.guild.id
|
|
|
|
|
|
|
|
|
|
|
|
# Define the statuses of the members within the discord
|
|
|
|
# Define the statuses of the members within the discord
|
|
|
|
statuses = [len(list(filter(lambda m: str(m.status) == "online", ctx.guild.members))),
|
|
|
|
statuses = [len(list(filter(lambda m: str(m.status) == "online", ctx.guild.members))),
|
|
|
|
len(list(filter(lambda m: str(m.status) == "idle", ctx.guild.members))),
|
|
|
|
len(list(filter(lambda m: str(m.status) == "idle", ctx.guild.members))),
|
|
|
|
len(list(filter(lambda m: str(m.status) == "dnd", ctx.guild.members))),
|
|
|
|
len(list(filter(lambda m: str(m.status) == "dnd", ctx.guild.members))),
|
|
|
|
len(list(filter(lambda m: str(m.status) == "offline", ctx.guild.members)))]
|
|
|
|
len(list(filter(lambda m: str(m.status) == "offline", ctx.guild.members)))]
|
|
|
|
|
|
|
|
|
|
|
|
# Set up embed to display all the server information
|
|
|
|
# Set up embed to display all the server information
|
|
|
|
embed = Embed(title="**Server Information**",
|
|
|
|
embed = Embed(title="**Server Information**",
|
|
|
|
colour=Colour(int(random.choice(settings.colour_list))),
|
|
|
|
colour=Colour(int(random.choice(settings.colour_list))),
|
|
|
|
timestamp=datetime.datetime.utcnow())
|
|
|
|
timestamp=datetime.datetime.utcnow())
|
|
|
|
embed.set_thumbnail(url=guild_icon)
|
|
|
|
embed.set_thumbnail(url=guild_icon)
|
|
|
|
embed.set_footer(text=f"ID: {guild_id}", icon_url='{}'.format(guild_icon))
|
|
|
|
embed.set_footer(text=f"ID: {guild_id}", icon_url='{}'.format(guild_icon))
|
|
|
|
|
|
|
|
|
|
|
|
# Define fields to be added into the embed
|
|
|
|
# Define fields to be added into the embed
|
|
|
|
fields = [("Owner", ctx.guild.owner, True),
|
|
|
|
fields = [("Owner", ctx.guild.owner, True),
|
|
|
|
("Created", ctx.guild.created_at.strftime("%d/%m/%Y %H:%M:%S"), False),
|
|
|
|
("Created", ctx.guild.created_at.strftime("%d/%m/%Y %H:%M:%S"), False),
|
|
|
|
("Region", str(ctx.guild.region).upper(), False),
|
|
|
|
("Region", str(ctx.guild.region).upper(), False),
|
|
|
|
("Statuses", f"🟢 {statuses[0]} 🟠 {statuses[1]} 🔴 {statuses[2]} ⚪ {statuses[3]}", False),
|
|
|
|
("Statuses", f"🟢 {statuses[0]} 🟠 {statuses[1]} 🔴 {statuses[2]} ⚪ {statuses[3]}", False),
|
|
|
|
("\u200b", "\u200b", False),
|
|
|
|
("\u200b", "\u200b", False),
|
|
|
|
("Members", len(ctx.guild.members), True),
|
|
|
|
("Members", len(ctx.guild.members), True),
|
|
|
|
("Humans", len(list(filter(lambda m: not m.bot, ctx.guild.members))), True),
|
|
|
|
("Humans", len(list(filter(lambda m: not m.bot, ctx.guild.members))), True),
|
|
|
|
("Bots", len(list(filter(lambda c: c.bot, ctx.guild.members))), True),
|
|
|
|
("Bots", len(list(filter(lambda c: c.bot, ctx.guild.members))), True),
|
|
|
|
("Banned Members", len(await ctx.guild.bans()), True),
|
|
|
|
("Banned Members", len(await ctx.guild.bans()), True),
|
|
|
|
("Text Channels", len(ctx.guild.text_channels), True),
|
|
|
|
("Text Channels", len(ctx.guild.text_channels), True),
|
|
|
|
("Voice Channels", len(ctx.guild.voice_channels), True),
|
|
|
|
("Voice Channels", len(ctx.guild.voice_channels), True),
|
|
|
|
("Categories", len(ctx.guild.categories), True),
|
|
|
|
("Categories", len(ctx.guild.categories), True),
|
|
|
|
("Roles", len(ctx.guild.roles), True),
|
|
|
|
("Roles", len(ctx.guild.roles), True),
|
|
|
|
("Invites", len(await ctx.guild.invites()), True)]
|
|
|
|
("Invites", len(await ctx.guild.invites()), True)]
|
|
|
|
|
|
|
|
|
|
|
|
# Add fields to the embed
|
|
|
|
# Add fields to the embed
|
|
|
|
for name, value, inline in fields:
|
|
|
|
for name, value, inline in fields:
|
|
|
|
embed.add_field(name=name, value=value, inline=inline)
|
|
|
|
embed.add_field(name=name, value=value, inline=inline)
|
|
|
|
|
|
|
|
|
|
|
|
# Send the embed to the channel that the command was triggered in
|
|
|
|
# Send the embed to the channel that the command was triggered in
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
await ctx.send(embed=embed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except Exception as ex:
|
|
|
|
|
|
|
|
print(ex)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setup(bot):
|
|
|
|
def setup(bot):
|
|
|
|