🐛 You can now challenge other players to connect four

This commit is contained in:
NikolajDanger
2021-04-04 18:23:08 +02:00
parent 5647cea552
commit aea2875957

View File

@ -53,16 +53,28 @@ class ConnectFour():
logMessage = "They tried to play against a difficulty that doesn't exist" logMessage = "They tried to play against a difficulty that doesn't exist"
canStart = False canStart = False
elif type(opponent) == discord.user: elif type(opponent) == discord.member.Member:
# Opponent is another player if opponent.bot:
if ctx.author != opponent: # User has challenged a bot
opponent = f"#{opponent.id}" if opponent == self.bot.user:
difficulty = 5 # It was Gwendolyn
diffText = "" difficulty = 3
diffText = f" with difficulty {difficulty}"
opponent = f"#{self.bot.user.id}"
else:
sendMessage = "You can't challenge a bot!"
logMessage = "They tried to challenge a bot"
canStart = False
else: else:
sendMessage = "You can't play against yourself" # Opponent is another player
logMessage = "They tried to play against themself" if ctx.author != opponent:
canStart = False opponent = f"#{opponent.id}"
difficulty = 5
diffText = ""
else:
sendMessage = "You can't play against yourself"
logMessage = "They tried to play against themself"
canStart = False
if canStart: if canStart:
board = [[0 for _ in range(COLUMNCOUNT)] for _ in range(ROWCOUNT)] board = [[0 for _ in range(COLUMNCOUNT)] for _ in range(ROWCOUNT)]