1
0
Fork 0
mirror of synced 2024-05-06 21:52:30 +12:00

Made function variables more explicit, for the help command to be more obvious

This commit is contained in:
phxntxm 2016-07-08 20:42:33 -05:00
parent 1f8b380b62
commit 45ab47bb75
3 changed files with 12 additions and 7 deletions

6
bot.py
View file

@ -41,6 +41,12 @@ async def on_member_join(member):
async def on_member_remove(member):
await bot.say("{0} has left the server, I hope it wasn't because of something I said :c".format(member))
@bot.event
async def on_command_error(error, ctx):
fmt = 'An error occurred while processing this request: ```py\n{}: {}\n```'
await bot.say(fmt.format(type(e).__name__, e))
if __name__ == '__main__':
for e in extensions:
bot.load_extension(e)

View file

@ -2,6 +2,7 @@ from discord.ext import commands
from .utils import checks
from .utils import config
from threading import Timer
import discord
import random
battling = False
@ -58,7 +59,7 @@ class Interaction:
self.bot = bot
@commands.command(pass_context=True, no_pm=True)
async def battle(self, ctx):
async def battle(self, ctx, player2: discord.Member):
"""Challenges the mentioned user to a battle"""
try:
global battleP1
@ -72,7 +73,6 @@ class Interaction:
if len(ctx.message.mentions) > 1:
await self.bot.say("You cannot battle more than one person at once!")
return
player2 = ctx.message.mentions[0]
if ctx.message.author.id == player2.id:
await self.bot.say("Why would you want to battle yourself? Suicide is not the answer")
return
@ -125,17 +125,16 @@ class Interaction:
await self.bot.say(fmt.format(type(e).__name__, e))
@commands.command(pass_context=True, no_pm=True)
async def boop(self, ctx):
async def boop(self, ctx, boopee: discord.Member):
"""Boops the mentioned person"""
try:
booper = ctx.message.author
if len(ctx.message.mentions) == 0:
await self.bot.say("You must mention someone in the room " + ctx.message.author.mention + "!")
return
if len(ctx.message.mentions) > 1:
await self.bot.say("You cannot boop more than one person at once!")
return
boopee = ctx.message.mentions[0]
booper = ctx.message.author
if boopee.id == booper.id:
await self.bot.say("You can't boop yourself! Silly...")
return

View file

@ -68,7 +68,7 @@ class Owner:
@commands.command()
@checks.isOwner()
async def avatar(self, content):
async def avatar(self, content: str):
"""Changes the avatar for the bot to the filename following the command"""
try:
file = '/home/phxntx5/public_html/bot/images/' + content
@ -80,7 +80,7 @@ class Owner:
@commands.command()
@checks.isOwner()
async def name(self, newNick):
async def name(self, newNick: str):
"""Changes the bot's name"""
try:
await self.bot.edit_profile(username=newNick)