self.bot = Bot | self.bot = Bot | ||||
@bot.command(pass_context=True) | @bot.command(pass_context=True) | ||||
async def avatar(self, ctx, user: discord.User = None): | |||||
async def avatar(self, ctx, *,user: discord.User = None): | |||||
""" | """ | ||||
Returns a mentioned users avatar | Returns a mentioned users avatar | ||||
Example: | Example: | ||||
{command_prefix}avatar @RoxBot#4170 | {command_prefix}avatar @RoxBot#4170 | ||||
{command_prefix}avatar RoxBot | {command_prefix}avatar RoxBot | ||||
""" | """ | ||||
if ctx.message.mentions: | |||||
user = ctx.message.mentions[0] | |||||
elif not user: | |||||
if not user: | |||||
user = ctx.message.author | user = ctx.message.author | ||||
url = user.avatar_url | url = user.avatar_url | ||||
@bot.command(pass_context=True) | @bot.command(pass_context=True) | ||||
async def emote(self, ctx, emote): | async def emote(self, ctx, emote): | ||||
""" | |||||
Gets a url to the emote given. Useful for downloading emotes. | |||||
""" | |||||
emoteid = emote.split(":")[-1].strip("<>") | emoteid = emote.split(":")[-1].strip("<>") | ||||
url = "https://discordapp.com/api/emojis/{}.png".format(emoteid) | url = "https://discordapp.com/api/emojis/{}.png".format(emoteid) | ||||
return await self.bot.say(url) | return await self.bot.say(url) |
@bot.event | @bot.event | ||||
async def on_message(message): | async def on_message(message): | ||||
# TODO: Check for words for reactions and check blacklist | |||||
# TODO: Check for words for reactions | |||||
if blacklisted(message.author): | if blacklisted(message.author): | ||||
return | return | ||||
return await bot.process_commands(message) | return await bot.process_commands(message) | ||||
# Bot Debug and Info | |||||
# TODO: Add command that has things like uptime in it and is outputted as a rich embed | |||||
# Error Handling, thanks for Der Eddy who did most of this stuff. <3 | # Error Handling, thanks for Der Eddy who did most of this stuff. <3 | ||||
@bot.event | @bot.event | ||||
@bot.command(pass_context=True) | @bot.command(pass_context=True) | ||||
async def about(ctx): | async def about(ctx): | ||||
""" | |||||
Outputs info about RoxBot, showing uptime, what settings where set in prefs.ini and credits. | |||||
""" | |||||
user = await bot.get_user_info(load_config.owner) | user = await bot.get_user_info(load_config.owner) | ||||
ownername = user.name + "#" + user.discriminator | ownername = user.name + "#" + user.discriminator | ||||
em = discord.Embed(title="About Roxbot", colour=load_config.embedcolour, description=load_config.description) | em = discord.Embed(title="About Roxbot", colour=load_config.embedcolour, description=load_config.description) |