Exemplo n.º 1
0
 async def adminremove_movie(self, ctx, data):
     """Removes the movie from any user's suggestions"""
     movie = await get_suggestion_name(ctx, 'movie', data)
     if movie:
         if suggestion_exists_check(self.bot.db_name, movie, 'movie'):
             with closing(sqlite3.connect(self.bot.db_name)) as con:
                 with con:
                     con.execute(
                         'DELETE FROM Suggestions WHERE suggestion LIKE ? AND suggestion_type=?;',
                         (movie, 'movie'))
                 if not suggestion_exists_check(self.bot.db_name, movie,
                                                'movie'):
                     await update_banner(ctx, 'movies')
                     await ctx.send(
                         f'Successfully deleted "{movie}" from movie suggestions'
                     )
                 else:
                     await ctx.send(
                         f'Error: couldn\'t delete "{movie}" from movie suggestions'
                     )
         else:
             await ctx.send(f'"{movie}" not found in movie suggestions')
     else:
         await ctx.send(
             f'Error: couldn\'t find anything matching "{data}" in movie suggestions'
         )
Exemplo n.º 2
0
 async def adminremove(self, ctx, data):
     """Removes the game from any user's suggestions"""
     game = await get_suggestion_name(ctx, 'game', data)
     if game:
         if suggestion_exists_check(self.bot.db_name, game, 'game'):
             with closing(sqlite3.connect(self.bot.db_name)) as con:
                 with con:
                     con.execute(
                         'DELETE FROM Suggestions WHERE suggestion LIKE ? AND suggestion_type=?;',
                         (game, 'game'))
                 if not suggestion_exists_check(self.bot.db_name, game,
                                                'game'):
                     await update_banner(ctx, 'games')
                     await ctx.send(
                         'Successfully deleted "{}" from game suggestions'.
                         format(game))
                 else:
                     await ctx.send(
                         'Couldn\'t delete "{}" from game suggestions, please contact Euqimor for troubleshooting'
                         .format(game))
         else:
             await ctx.send(
                 '"{}" not found in game suggestions'.format(game))
     else:
         await ctx.send(
             f'Couldn\'t find anything matching "{data}" in game suggestions'
         )
Exemplo n.º 3
0
 async def remove_movie(self, ctx, *, data):
     """Removes the movie suggestion if the movie was suggested by the user issuing the command"""
     if await check_admin_rights(ctx):
         await self.adminremove_movie(ctx, data)
     else:
         user_id = ctx.author.id
         username = str(ctx.author.name)
         movie = await get_suggestion_name(ctx, 'movie', data)
         if movie:
             with closing(sqlite3.connect(self.bot.db_name)) as con:
                 with con:
                     con.execute(
                         'UPDATE OR IGNORE Users SET username=? WHERE user_id=?;',
                         (username, user_id))
                     con.execute(
                         'INSERT OR IGNORE INTO Users(username, user_id) VALUES(?, ?);',
                         (username, user_id))
                 if suggestion_exists_check(self.bot.db_name, movie,
                                            'movie', user_id):
                     with con:
                         con.execute(
                             'DELETE FROM Suggestions WHERE user_id=? AND suggestion LIKE ? AND suggestion_type=?;',
                             (user_id, movie, 'movie'))
                     if not suggestion_exists_check(self.bot.db_name, movie,
                                                    'movie', user_id):
                         await update_banner(ctx, 'movies')
                         await ctx.send(
                             f'Successfully deleted "{movie}" from {username}\'s movie suggestions'
                         )
                     else:
                         await ctx.send(
                             f'Error: couldn\'t delete "{movie}" from {username}\'s movie suggestions'
                         )
                 else:
                     await ctx.send(
                         f'Error: "{movie}" not found in {username}\'s movie suggestions'
                     )
         else:
             await ctx.send(
                 f'Error: couldn\'t find anything matching "{data}" in {username}\'s suggestions'
             )
Exemplo n.º 4
0
 async def remove(self, ctx, *, data):
     """Removes the game suggestion if the game was suggested by the user issuing the command"""
     if await check_admin_rights(ctx):
         await self.adminremove(ctx, data)
     else:
         user_id = ctx.author.id
         username = str(ctx.author.name)
         game = await get_suggestion_name(ctx, 'game', data)
         if game:
             with closing(sqlite3.connect(self.bot.db_name)) as con:
                 with con:
                     con.execute(
                         'UPDATE OR IGNORE Users SET username=? WHERE user_id=?;',
                         (username, user_id))
                     con.execute(
                         'INSERT OR IGNORE INTO Users(username, user_id) VALUES(?, ?);',
                         (username, user_id))
                 if suggestion_exists_check(self.bot.db_name, game, 'game',
                                            user_id):
                     with con:
                         con.execute(
                             'DELETE FROM Suggestions WHERE user_id=? AND suggestion LIKE ? AND suggestion_type=?;',
                             (user_id, game, 'game'))
                     if not suggestion_exists_check(self.bot.db_name, game,
                                                    'game', user_id):
                         await update_banner(ctx, 'games')
                         await ctx.send(
                             'Successfully deleted "{}" from {}\'s game suggestions'
                             .format(game, username))
                     else:
                         await ctx.send(
                             'Couldn\'t delete "{}" from {}\'s game suggestions, please contact Euqimor for troubleshooting'
                             .format(game, username))
                 else:
                     await ctx.send(
                         '"{}" not found in {}\'s game suggestions'.format(
                             game, username))
         else:
             await ctx.send(
                 f'Couldn\'t find anything matching "{data}" in {username}\'s suggestions'
             )