Skip to content

Commit b1ffa83

Browse files
committed
Improve logic
1 parent d8bb20e commit b1ffa83

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

main.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -185,20 +185,16 @@ async def on_command_error(ctx, error):
185185
@client.event
186186
async def on_message(message):
187187
global count
188-
if str(message.channel.id) in count: pass
189-
else:
188+
if str(message.channel.id) not in count:
190189
count[str(message.channel.id)] = 1
191190
savedata()
192-
if str(message.guild.id) in countchannel: pass
193-
else:
191+
if str(message.guild.id) not in countchannel:
194192
countchannel[str(message.guild.id)] = 0
195193
savedata()
196-
if str(message.guild.id) in warnmsg: pass
197-
else:
194+
if str(message.guild.id) not in warnmsg:
198195
warnmsg[str(message.guild.id)] = 0
199196
savedata()
200-
if str(message.guild.id) in autoreactions: pass
201-
else:
197+
if str(message.guild.id) not in autoreactions:
202198
autoreactions[str(message.guild.id)] = 1
203199
savedata()
204200
if not message.author.bot:
@@ -207,17 +203,12 @@ async def on_message(message):
207203
if int(message.content) == count[str(message.channel.id)]:
208204
count[str(message.channel.id)] += 1
209205
if autoreactions[str(message.guild.id)] == 1: await message.add_reaction('☑')
210-
else: pass
211206
savedata()
212207
else:
213208
if autoreactions[str(message.guild.id)] == 1: await message.add_reaction('❌')
214-
else: pass
215209
await message.reply(f'**Wrong!** The next number is `{count[str(message.channel.id)]}`', mention_author = False, delete_after = 3)
216210
except:
217211
if autoreactions[str(message.guild.id)] == 1: await message.add_reaction('⚠')
218-
else: pass
219-
else: pass
220-
else: pass
221212
await client.process_commands(message)
222213

223214
# Commands
@@ -256,9 +247,8 @@ async def serverstats(ctx):
256247
@client.command()
257248
@commands.has_permissions(administrator = True)
258249
async def setchannel(ctx):
259-
channel_to_set = ctx.channel.id
260250
try:
261-
countchannel[str(ctx.guild.id)] = channel_to_set
251+
countchannel[str(ctx.guild.id)] = ctx.channel.id
262252
savedata()
263253
await ctx.send(f':white_check_mark: <#{channel_to_set}> set as counting channel.')
264254
except: await ctx.send(':x: Unable to set count channel. Try again later.')

0 commit comments

Comments
 (0)