Beispiel #1
0
 async def delete_idol_alias(self, ctx, group, idol, *aliases):
     """Removes an alias from an idol.
     A list of aliases can be passed through in one command, but only one idol.
     Please ensure you use the members name, and not an alias for the second argument.
     Example: .remove_idol_alias redvelvet joy j
     Example: .remove_idol_alias <group> <idol> <alias1> <alias2>"""
     group = group.lower()
     idol = idol.lower()
     removed_aliases = []
     invalid_aliases = []
     for alias in aliases:
         alias = alias.lower()
         removed = remove_member_alias_db(group, idol, alias)
         if removed:
             removed_aliases.append(alias)
         else:
             invalid_aliases.append(alias)
     if invalid_aliases and removed_aliases:
         exists = ', '.join(invalid_aliases)
         rem = ', '.join(removed_aliases)
         act = f"Removed alias(es): {rem} from {idol}!"
         await moderation_auditing(self.disclient, ctx.author, act)
         msg = f"Removed alias(es): {rem} from {group}!\nFailed to removed: {exists}!"
         await ctx.send(embed=success_embed(msg))
     elif removed_aliases and not invalid_aliases:
         msg = f"Removed aliases(s): {', '.join(removed_aliases)} from {idol}!"
         await moderation_auditing(self.disclient, ctx.author, msg)
         await ctx.send(embed=success_embed(msg))
     else:
         msg = f"""Failed to remove alias(es): {', '.join(invalid_aliases)} from {idol}!
                \nPlease make sure you do not use an alias for the idol name."""
         await ctx.send(embed=error_embed(msg))
Beispiel #2
0
 async def delete_group_alias(self, ctx, group, *aliases):
     """Removes an alias from an existing group.
     A list of aliases can be passed through in one command, but only one group.
     Example: .remove_group_alias redvelvet rv
     Example: .remove_group_alias <group> <alias1> <alias2>"""
     group = group.lower()
     removed_aliases = []
     invalid_aliases = []
     for alias in aliases:
         alias = alias.lower()
         removed = remove_group_alias_db(group, alias)
         if removed:
             removed_aliases.append(alias)
         else:
             invalid_aliases.append(alias)
     if invalid_aliases and removed_aliases:
         exists = ', '.join(invalid_aliases)
         rem = ', '.join(removed_aliases)
         act = f"Removed alias(es): {rem} from {group}!"
         await moderation_auditing(self.disclient, ctx.author, act)
         msg = f"Removed alias(es): {rem} from {group}!\nFailed to removed: {exists}!"
         await ctx.send(embed=success_embed(msg))
     elif removed_aliases and not invalid_aliases:
         msg = f"Removed aliases(s): {', '.join(removed_aliases)} from {group}!"
         await moderation_auditing(self.disclient, ctx.author, msg)
         await ctx.send(embed=success_embed(msg))
     else:
         msg = f"Failed to remove alias(es): {', '.join(invalid_aliases)} from {group}!"
         await ctx.send(embed=error_embed(msg))
Beispiel #3
0
 async def add_idol_alias(self, ctx, group, idol, *aliases):
     """Adds an alias to an idol.
     A list of aliases can be passed through in one command, but only one idol.
     Please ensure you use the members name, and not an alias for the second argument.
     Example: .add_idol_alias redvelvet joy j
     Example: .add_idol_alias <group> <idol> <alias1> <alias2>"""
     group = group.lower()
     idol = idol.lower()
     added_aliases = []
     invalid_aliases = []
     for alias in aliases:
         alias = alias.lower()
         added = add_member_alias_db(group, idol, alias, ctx.author.id)
         if added:
             added_aliases.append(alias)
         else:
             invalid_aliases.append(alias)
     if invalid_aliases and added_aliases:
         exists = ', '.join(invalid_aliases)
         rem = ', '.join(added_aliases)
         act = f"Added alias(es): {rem} to {idol}!"
         await moderation_auditing(self.disclient, ctx.author, act)
         msg = f"Added alias(es): {rem} to {group}!\nFailed to add: {exists}!"
         await ctx.send(embed=success_embed(msg))
     elif added_aliases and not invalid_aliases:
         msg = f"Added aliases(s): {', '.join(added_aliases)} to {idol}!"
         await moderation_auditing(self.disclient, ctx.author, msg)
         await ctx.send(embed=success_embed(msg))
     else:
         msg = f"Failed to add alias(es): {', '.join(invalid_aliases)} to {idol}!"
         await ctx.send(embed=error_embed(msg))
Beispiel #4
0
 async def add_group_alias(self, ctx, group, *aliases):
     """Adds an alias to an existing group that can then be used to
     reference the group in other commands. A list of aliases can be
     passed through in one command, but only one group.
     Example: .add_group_alias redvelvet rv
     Example: .add_group_alias <group> <alias1> <alias2>"""
     group = group.lower()
     added_aliases = []
     invalid_aliases = []
     for alias in aliases:
         alias = alias.lower()
         added = add_group_alias_db(group, alias, ctx.author.id)
         if added:
             added_aliases.append(alias)
         else:
             invalid_aliases.append(alias)
     if invalid_aliases and added_aliases:
         exists = ', '.join(invalid_aliases)
         add = ', '.join(added_aliases)
         act = f"Added alias(es): {add} to {group}!"
         await moderation_auditing(self.disclient, ctx.author, act)
         msg = f"Added alias(es): {add} to {group}!\nSkipped adding duplicates: {exists}!"
         await ctx.send(embed=success_embed(msg))
     elif added_aliases and not invalid_aliases:
         msg = f"Added aliases(s): {', '.join(added_aliases)} to {group}!"
         await moderation_auditing(self.disclient, ctx.author, msg)
         await ctx.send(embed=success_embed(msg))
     else:
         msg = f"Skipped adding duplicate alias(es): {', '.join(invalid_aliases)}!"
         await ctx.send(embed=error_embed(msg))
Beispiel #5
0
 async def add_group(self, ctx, *args):
     """Adds a group or list of groups"""
     group_list = args
     if not group_list:
         await ctx.send(embed=error_embed('No group(s) given!'))
     else:
         # Update to string instead of list
         already_exists = []
         added = []
         for group in group_list:
             groupstr = str(group).lower()
             success = add_group(groupstr, ctx.author.id)
             if success:
                 added.append(groupstr)
                 add_group_alias_db(groupstr, groupstr, ctx.author.id)
             else:
                 already_exists.append(groupstr)
         if already_exists and added:
             exists = ', '.join(already_exists)
             add = ', '.join(added)
             act = f"Added group(s): {add}!"
             await moderation_auditing(self.disclient, ctx.author, act)
             msg = f"Added group(s): {add}!\nSkipped adding duplicates: {exists}!"
             await ctx.send(embed=success_embed(msg))
         elif added and not already_exists:
             msg = f"Added group(s): {', '.join(added)}!"
             await moderation_auditing(self.disclient, ctx.author, msg)
             await ctx.send(embed=success_embed(msg))
         else:
             msg = f"Skipped adding duplicates: {', '.join(already_exists)}!"
             await ctx.send(embed=error_embed(msg))
Beispiel #6
0
 async def remove_perma_user(self, ctx, user_id):
     """Removes user from perma ban"""
     unperma = remove_perma_user_db(user_id)
     if unperma:
         await ctx.send(embed=success_embed("User un-perma'd."))
     else:
         await ctx.send(embed=error_embed("Failed to un-perma user."))
Beispiel #7
0
 async def perma_user(self, ctx, user_id):
     """Stops user from added anything to the bot"""
     perma = perma_user_db(user_id)
     if perma:
         await ctx.send(embed=success_embed("User successfully perma'd."))
     else:
         await ctx.send(embed=error_embed("Failed to perma user."))
Beispiel #8
0
    async def add_idols(self, ctx, group, *args):
        """Adds an idol to an already existing group"""
        group = group.lower()
        g_id = find_group_id(group)
        if not g_id:
            await ctx.send(embed=error_embed(f'Group {group} does not exist!'))
            return

        if not args:
            await ctx.send(embed=error_embed('No idols provided!'))
        else:
            # rework lists to strings once working
            members = get_members_of_group(group)
            members = [x[0] for x in members]
            members = set(members)
            args = set(args)
            already_exists = members.intersection(args)
            idol_list = args - members
            added = []
            for idol in idol_list:
                idol = str(idol).lower()
                add_member(group, idol, ctx.author.id)
                add_member_alias_db(group, idol, idol, ctx.author.id)
                added.append(idol)
            if already_exists and added:
                exists = ', '.join(already_exists)
                add = ', '.join(added)
                act = f"Added idol(s): {add} to {group}!"
                await moderation_auditing(self.disclient, ctx.author, act)
                msg = f"Added idol(s): {add} to {group}!\nSkipped adding duplicates: {exists}!"
                await ctx.send(embed=success_embed(msg))
            elif added and not already_exists:
                msg = f"Added idol(s): {', '.join(added)} to {group}!"
                await moderation_auditing(self.disclient, ctx.author, msg)
                await ctx.send(embed=success_embed(msg))
            else:
                msg = f"Skipped adding duplicates: {', '.join(already_exists)}!"
                await ctx.send(embed=error_embed(msg))