1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-25 06:37:29 +00:00

Comment out favorites group

This commit is contained in:
Dylan Dizon 2018-11-15 15:48:36 -05:00
parent 5d57ef300f
commit d87c35b3da

View file

@ -1284,110 +1284,110 @@ class MsG:
await ctx.send('**Request timed out**') await ctx.send('**Request timed out**')
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@cmds.group(aliases=['fave', 'fav', 'f']) # @cmds.group(aliases=['fave', 'fav', 'f'])
async def favorite(self, ctx): # async def favorite(self, ctx):
if not ctx.invoked_subcommand: # if not ctx.invoked_subcommand:
await ctx.send('**Use a flag to manage favorites.**\n*Type* `{}help fav` *for more info.*'.format(ctx.prefix)) # await ctx.send('**Use a flag to manage favorites.**\n*Type* `{}help fav` *for more info.*'.format(ctx.prefix))
await ctx.message.add_reaction('\N{CROSS MARK}') # await ctx.message.add_reaction('\N{CROSS MARK}')
#
@favorite.error # @favorite.error
async def favorite_error(self, ctx, error): # async def favorite_error(self, ctx, error):
pass # pass
#
@favorite.group(name='get', aliases=['g']) # @favorite.group(name='get', aliases=['g'])
async def _get_favorite(self, ctx): # async def _get_favorite(self, ctx):
pass # pass
#
@_get_favorite.command(name='tags', aliases=['t']) # @_get_favorite.command(name='tags', aliases=['t'])
async def __get_favorite_tags(self, ctx, *args): # async def __get_favorite_tags(self, ctx, *args):
await ctx.send('\N{WHITE MEDIUM STAR} {}**\'s favorite tags:**\n```\n{}```'.format(ctx.author.mention, ' '.join(self.favorites.get(ctx.author.id, {}).get('tags', set())))) # await ctx.send('\N{WHITE MEDIUM STAR} {}**\'s favorite tags:**\n```\n{}```'.format(ctx.author.mention, ' '.join(self.favorites.get(ctx.author.id, {}).get('tags', set()))))
#
@_get_favorite.command(name='posts', aliases=['p']) # @_get_favorite.command(name='posts', aliases=['p'])
async def __get_favorite_posts(self, ctx): # async def __get_favorite_posts(self, ctx):
pass # pass
#
@favorite.group(name='add', aliases=['a']) # @favorite.group(name='add', aliases=['a'])
async def _add_favorite(self, ctx): # async def _add_favorite(self, ctx):
pass # pass
#
@_add_favorite.command(name='tags', aliases=['t']) # @_add_favorite.command(name='tags', aliases=['t'])
async def __add_favorite_tags(self, ctx, *args): # async def __add_favorite_tags(self, ctx, *args):
try: # try:
kwargs = u.get_kwargs(ctx, args) # kwargs = u.get_kwargs(ctx, args)
tags = kwargs['remaining'] # tags = kwargs['remaining']
#
for tag in tags: # for tag in tags:
if tag in self.blacklists['user_blacklist'].get(ctx.author.id, set()): # if tag in self.blacklists['user']['blacklist'].get(ctx.author.id, set()):
raise exc.TagBlacklisted(tag) # raise exc.TagBlacklisted(tag)
with suppress(KeyError): # with suppress(KeyError):
if len(self.favorites[ctx.author.id]['tags']) + len(tags) > 5: # if len(self.favorites[ctx.author.id]['tags']) + len(tags) > 5:
raise exc.BoundsError # raise exc.BoundsError
#
self.favorites.setdefault(ctx.author.id, {}).setdefault( # self.favorites.setdefault(ctx.author.id, {}).setdefault(
'tags', set()).update(tags) # 'tags', set()).update(tags)
u.dump(self.favorites, 'cogs/favorites.pkl') # u.dump(self.favorites, 'cogs/favorites.pkl')
#
await ctx.send('{} **added to their favorites:**\n```\n{}```'.format(ctx.author.mention, ' '.join(tags))) # await ctx.send('{} **added to their favorites:**\n```\n{}```'.format(ctx.author.mention, ' '.join(tags)))
#
except exc.BoundsError: # except exc.BoundsError:
await ctx.send('**Favorites list currently limited to:** `5`') # await ctx.send('**Favorites list currently limited to:** `5`')
await ctx.message.add_reaction('\N{CROSS MARK}') # await ctx.message.add_reaction('\N{CROSS MARK}')
except exc.TagBlacklisted as e: # except exc.TagBlacklisted as e:
await ctx.send('\N{NO ENTRY SIGN} `{}` **blacklisted**') # await ctx.send('\N{NO ENTRY SIGN} `{}` **blacklisted**')
await ctx.message.add_reaction('\N{NO ENTRY SIGN}') # await ctx.message.add_reaction('\N{NO ENTRY SIGN}')
#
@_add_favorite.command(name='posts', aliases=['p']) # @_add_favorite.command(name='posts', aliases=['p'])
async def __add_favorite_posts(self, ctx, *posts): # async def __add_favorite_posts(self, ctx, *posts):
pass # pass
#
@favorite.group(name='remove', aliases=['r']) # @favorite.group(name='remove', aliases=['r'])
async def _remove_favorite(self, ctx): # async def _remove_favorite(self, ctx):
pass # pass
#
@_remove_favorite.command(name='tags', aliases=['t']) # @_remove_favorite.command(name='tags', aliases=['t'])
async def __remove_favorite_tags(self, ctx, *args): # async def __remove_favorite_tags(self, ctx, *args):
try: # try:
kwargs = u.get_kwargs(ctx, args) # kwargs = u.get_kwargs(ctx, args)
tags = kwargs['remaining'] # tags = kwargs['remaining']
#
for tag in tags: # for tag in tags:
try: # try:
self.favorites[ctx.author.id].get( # self.favorites[ctx.author.id].get(
'tags', set()).remove(tag) # 'tags', set()).remove(tag)
#
except KeyError: # except KeyError:
raise exc.TagError(tag) # raise exc.TagError(tag)
#
u.dump(self.favorites, 'cogs/favorites.pkl') # u.dump(self.favorites, 'cogs/favorites.pkl')
#
await ctx.send('{} **removed from their favorites:**\n```\n{}```'.format(ctx.author.mention, ' '.join(tags))) # await ctx.send('{} **removed from their favorites:**\n```\n{}```'.format(ctx.author.mention, ' '.join(tags)))
#
except KeyError: # except KeyError:
await ctx.send('**You do not have any favorites**') # await ctx.send('**You do not have any favorites**')
await ctx.message.add_reaction('\N{CROSS MARK}') # await ctx.message.add_reaction('\N{CROSS MARK}')
except exc.TagError as e: # except exc.TagError as e:
await ctx.send('`{}` **not in favorites**'.format(e)) # await ctx.send('`{}` **not in favorites**'.format(e))
await ctx.message.add_reaction('\N{CROSS MARK}') # await ctx.message.add_reaction('\N{CROSS MARK}')
#
@_remove_favorite.command(name='posts', aliases=['p']) # @_remove_favorite.command(name='posts', aliases=['p'])
async def __remove_favorite_posts(self, ctx): # async def __remove_favorite_posts(self, ctx):
pass # pass
#
@favorite.group(name='clear', aliases=['c']) # @favorite.group(name='clear', aliases=['c'])
async def _clear_favorite(self, ctx): # async def _clear_favorite(self, ctx):
pass # pass
#
@_clear_favorite.command(name='tags', aliases=['t']) # @_clear_favorite.command(name='tags', aliases=['t'])
async def __clear_favorite_tags(self, ctx, *args): # async def __clear_favorite_tags(self, ctx, *args):
with suppress(KeyError): # with suppress(KeyError):
del self.favorites[ctx.author.id] # del self.favorites[ctx.author.id]
u.dump(self.favorites, 'cogs/favorites.pkl') # u.dump(self.favorites, 'cogs/favorites.pkl')
#
await ctx.send('{}**\'s favorites cleared**'.format(ctx.author.mention)) # await ctx.send('{}**\'s favorites cleared**'.format(ctx.author.mention))
#
@_clear_favorite.command(name='posts', aliases=['p']) # @_clear_favorite.command(name='posts', aliases=['p'])
async def __clear_favorite_posts(self, ctx): # async def __clear_favorite_posts(self, ctx):
pass # pass
# Umbrella command structure to manage global, channel, and user blacklists # Umbrella command structure to manage global, channel, and user blacklists
@cmds.group(aliases=['bl', 'b'], brief='(G) Manage blacklists', description='Manage channel or personal blacklists\n\nUsage:\n{p}bl get {blacklist} to show a blacklist\n{p}bl clear {blacklist} to clear a blacklist\n{p}bl add {blacklist} {tags...} to add tag(s) to a blacklist\n{p}bl remove {blacklist} {tags...} to remove tags from a blacklist') @cmds.group(aliases=['bl', 'b'], brief='(G) Manage blacklists', description='Manage channel or personal blacklists\n\nUsage:\n{p}bl get {blacklist} to show a blacklist\n{p}bl clear {blacklist} to clear a blacklist\n{p}bl add {blacklist} {tags...} to add tag(s) to a blacklist\n{p}bl remove {blacklist} {tags...} to remove tags from a blacklist')