1
0
Fork 0
mirror of synced 2024-09-28 07:21:16 +12:00
This commit is contained in:
Phxntxm 2016-09-09 22:29:38 -05:00
commit 327d17b48b
2 changed files with 21 additions and 0 deletions

View file

@ -114,6 +114,9 @@ class Hangman:
"""Makes a guess towards the server's currently running hangman game""" """Makes a guess towards the server's currently running hangman game"""
game = self.games.get(ctx.message.server.id) game = self.games.get(ctx.message.server.id)
if not game: if not game:
bucket = ctx.command._buckets.get_bucket(ctx)
bucket.is_rate_limited()
bucket._token = bucket.rate
await self.bot.say("There are currently no hangman games running!") await self.bot.say("There are currently no hangman games running!")
return return
@ -123,6 +126,9 @@ class Hangman:
# And also add a message for a loss/win # And also add a message for a loss/win
if len(guess) == 1: if len(guess) == 1:
if guess in game.guessed_letters: if guess in game.guessed_letters:
bucket = ctx.command._buckets.get_bucket(ctx)
bucket.is_rate_limited()
bucket._tokens = bucket.rate
await self.bot.say("That letter has already been guessed!") await self.bot.say("That letter has already been guessed!")
# Return here as we don't want to count this as a failure # Return here as we don't want to count this as a failure
return return

View file

@ -93,12 +93,21 @@ class Interaction:
async def battle(self, ctx, player2: discord.Member): async def battle(self, ctx, player2: discord.Member):
"""Challenges the mentioned user to a battle""" """Challenges the mentioned user to a battle"""
if ctx.message.author.id == player2.id: if ctx.message.author.id == player2.id:
bucket = ctx.command._buckets.get_bucket(ctx)
bucket.is_rate_limited()
bucket._tokens = bucket.rate
await self.bot.say("Why would you want to battle yourself? Suicide is not the answer") await self.bot.say("Why would you want to battle yourself? Suicide is not the answer")
return return
if self.bot.user.id == player2.id: if self.bot.user.id == player2.id:
bucket = ctx.command._buckets.get_bucket(ctx)
bucket.is_rate_limited()
bucket._tokens = bucket.rate
await self.bot.say("I always win, don't even try it.") await self.bot.say("I always win, don't even try it.")
return return
if self.user_battling(ctx, player2): if self.user_battling(ctx, player2):
bucket = ctx.command._buckets.get_bucket(ctx)
bucket.is_rate_limited()
bucket._tokens = bucket.rate
await self.bot.say("You or the person you are trying to battle is already in a battle!") await self.bot.say("You or the person you are trying to battle is already in a battle!")
return return
@ -167,9 +176,15 @@ class Interaction:
"""Boops the mentioned person""" """Boops the mentioned person"""
booper = ctx.message.author booper = ctx.message.author
if boopee.id == booper.id: if boopee.id == booper.id:
bucket = ctx.command._buckets.get_bucket(ctx)
bucket.is_rate_limited()
bucket._tokens = bucket.rate
await self.bot.say("You can't boop yourself! Silly...") await self.bot.say("You can't boop yourself! Silly...")
return return
if boopee.id == self.bot.user.id: if boopee.id == self.bot.user.id:
bucket = ctx.command._buckets.get_bucket(ctx)
bucket.is_rate_limited()
bucket._tokens = bucket.rate
await self.bot.say("Why the heck are you booping me? Get away from me >:c") await self.bot.say("Why the heck are you booping me? Get away from me >:c")
return return