Checking member/channel in a single line

pull/8/head
sgoudham 4 years ago
parent 2c33c711d5
commit 3e1d6b4784

@ -8,7 +8,7 @@ from platform import python_version
from time import time from time import time
from typing import Optional from typing import Optional
from discord import Colour, Member from discord import Colour, Member, TextChannel
from discord import Embed from discord import Embed
from discord import __version__ as discord_version from discord import __version__ as discord_version
from discord.ext.commands import BucketType, cooldown, bot_has_permissions, guild_only, Cog from discord.ext.commands import BucketType, cooldown, bot_has_permissions, guild_only, Cog
@ -137,12 +137,9 @@ class Info(Cog):
async def user_info(self, ctx, member: Optional[Member] = None): async def user_info(self, ctx, member: Optional[Member] = None):
"""User Information! (Created At/Joined/Roles etc)""" """User Information! (Created At/Joined/Roles etc)"""
# If a member has been specified, set them as the user # Use member when mentioned
if member: # Use author if no member is mentioned
member = member member = ctx.author if not member else member
# If no member has been specified, choose the author
else:
member = ctx.author
# Get the member avatar # Get the member avatar
userAvatar = member.avatar_url userAvatar = member.avatar_url
@ -302,11 +299,11 @@ class Info(Cog):
@command(name="channelinfo", aliases=["chinfo"]) @command(name="channelinfo", aliases=["chinfo"])
@guild_only() @guild_only()
@bot_has_permissions(embed_links=True) @bot_has_permissions(embed_links=True)
async def channel_info(self, ctx): async def channel_info(self, ctx, channel: Optional[TextChannel] = None):
"""Channel Statistics! (Category/Created At etc)""" """Channel Statistics! (Category/Created At etc)"""
# Get the channel that the user is in # Get the channel that the user is in
channel = ctx.channel channel = ctx.channel if not channel else channel
# Set up Embed # Set up Embed
embed = Embed(title=f"Statistics For #{channel.name}", embed = Embed(title=f"Statistics For #{channel.name}",

Loading…
Cancel
Save