Correct how to get the guild
This commit is contained in:
parent
86a8d57666
commit
d7f3307e62
|
@ -86,7 +86,7 @@ class Interaction:
|
||||||
self.battles = {}
|
self.battles = {}
|
||||||
|
|
||||||
def can_battle(self, player):
|
def can_battle(self, player):
|
||||||
battles = self.battles.get(ctx.message.guild.id)
|
battles = self.battles.get(player.guild.id)
|
||||||
|
|
||||||
if battles is None:
|
if battles is None:
|
||||||
return True
|
return True
|
||||||
|
@ -97,7 +97,7 @@ class Interaction:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def can_be_battled(self, player):
|
def can_be_battled(self, player):
|
||||||
battles = self.battles.get(ctx.message.guild.id)
|
battles = self.battles.get(player.guild.id)
|
||||||
|
|
||||||
if battles is None:
|
if battles is None:
|
||||||
return True
|
return True
|
||||||
|
@ -108,21 +108,21 @@ class Interaction:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def start_battle(self, guild, player1, player2):
|
def start_battle(self, player1, player2):
|
||||||
battles = self.battles.get(guild.id, [])
|
battles = self.battles.get(player1.guild.id, [])
|
||||||
entry = {
|
entry = {
|
||||||
'p1': player1.id,
|
'p1': player1.id,
|
||||||
'p2': player2.id
|
'p2': player2.id
|
||||||
}
|
}
|
||||||
battles.append(entry)
|
battles.append(entry)
|
||||||
self.battles[guild.id] = battles
|
self.battles[player1.guild.id] = battles
|
||||||
|
|
||||||
# Handles removing the author from the dictionary of battles
|
# Handles removing the author from the dictionary of battles
|
||||||
def battling_off(self, player):
|
def battling_off(self, player):
|
||||||
battles = self.battles.get(ctx.message.guild.id, [])
|
battles = self.battles.get(player.guild.id, [])
|
||||||
# Create a new list, exactly the way the last one was setup
|
# Create a new list, exactly the way the last one was setup
|
||||||
# But don't include the one start with player's ID
|
# But don't include the one start with player's ID
|
||||||
self.battles[ctx.message.guild.id] = [
|
self.battles[player.guild.id] = [
|
||||||
x
|
x
|
||||||
for x in battles
|
for x in battles
|
||||||
if x['p1'] != player.id
|
if x['p1'] != player.id
|
||||||
|
|
Loading…
Reference in a new issue