Remove redundant 'user' variable

Also declare 'chan' in a different way
This commit is contained in:
Ultracoolguy 2020-11-15 19:39:54 -04:00
parent c5d7e1deb9
commit 932e51bae7
1 changed files with 3 additions and 6 deletions

9
bot.py
View File

@ -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"]))