From 932e51bae79bdb0c7d3bae227d8a4a0b13ac2b51 Mon Sep 17 00:00:00 2001 From: Ultracoolguy Date: Sun, 15 Nov 2020 19:39:54 -0400 Subject: [PATCH] Remove redundant 'user' variable Also declare 'chan' in a different way --- bot.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/bot.py b/bot.py index 6feaced..ec066e8 100755 --- a/bot.py +++ b/bot.py @@ -32,13 +32,12 @@ class Server(BaseServer): print(f"connected to {self.isupport.network}") await self.send(build("JOIN", [chan])) - elif "PRIVMSG" in line.command and chan in line.params[0]: - user = line.source.split('!')[0] + elif "PRIVMSG" in line.command and chan in line.params[0]: + chan = self.channels[line.params[0]].name if line.params[1].startswith(".matchmake"): channel = self.channels[line.params[0]] ping = "" - for player in match_players: pfold = self.casefold(player) if pfold in channel.users: @@ -48,7 +47,6 @@ class Server(BaseServer): elif line.params[1].startswith(".matchadd"): - channel = self.channels[line.params[0]] if user in match_players: await self.send(build("PRIVMSG", [chan, "ERROR: player already in list."])) else: @@ -57,7 +55,6 @@ class Server(BaseServer): await self.send(build("PRIVMSG", [chan, "Added to the match list."])) elif line.params[1].startswith(".matchdel"): - channel = self.channels[line.params[0]] user = line.source.split('!')[0] if user not in match_players: await self.send(build("PRIVMSG", [chan, "ERROR: player isn't in list."])) @@ -67,7 +64,7 @@ class Server(BaseServer): await self.send(build("PRIVMSG", [chan, "Removed from match list."])) elif line.params[1].startswith(".help"): - await self.send(build("PRIVMSG", [chan, "Matchmaking bot commands:"])) #The ordering of this isn't actually what gets sent. Fix later + await self.send(build("PRIVMSG", [chan, "Matchmaking bot commands:"])) await self.send(build("PRIVMSG", [chan, " .matchadd: Add yourself to the match list"])) await self.send(build("PRIVMSG", [chan, " .matchdel: Remove yourself from the match list"])) await self.send(build("PRIVMSG", [chan, " .matchmake: Ping everyone on match list"]))