@@ 152-165 (lines=14) @@ | ||
149 | levels = json.load(infile) |
|
150 | i = 0 |
|
151 | for level in levels: |
|
152 | if level['link'].lower() == mat[0].lower(): |
|
153 | if level['twitchID'] == ctx.author.id or ctx.author.is_mod: |
|
154 | if i == 0: |
|
155 | await ctx.send('Cannot remove level due to it currently being played.') |
|
156 | else: |
|
157 | lname = level['levelName'] |
|
158 | levels.pop(i) |
|
159 | with open(path, 'w') as outfile: |
|
160 | json.dump(levels, outfile) |
|
161 | ||
162 | await self.send_message(f'Succesfully removed {lname} from list!', ctx) |
|
163 | else: |
|
164 | await self.send_message('Cannot remove level because {0} submitted it, not {1}.'.format(level['submitterName'], ctx.author.display_name), ctx) |
|
165 | break |
|
166 | i += 1 |
|
167 | ||
168 | else: |
|
@@ 195-207 (lines=13) @@ | ||
192 | levels = json.load(infile) |
|
193 | i = 0 |
|
194 | for level in levels: |
|
195 | if level['levelName'].lower() == mat.group(1).lower(): |
|
196 | if level['twitchID'] == ctx.author.id or ctx.author.is_mod: |
|
197 | if i == 0: |
|
198 | await ctx.send('Cannot remove level due to it currently being played.') |
|
199 | else: |
|
200 | lname = level['levelName'] |
|
201 | levels.pop(i) |
|
202 | with open(path, 'w') as outfile: |
|
203 | json.dump(levels, outfile) |
|
204 | await self.send_message(f'Succesfully removed {lname} from list!', ctx) |
|
205 | else: |
|
206 | await self.send_message('Cannot remove level because {0} submitted it, not {1}.'.format(level['submitterName'], ctx.author.display_name), ctx) |
|
207 | break |
|
208 | i += 1 |
|
209 | else: |
|
210 | mat = findall(f"{self.settings[5]}([\\w]+)\\s", ctx.content) |