Beispiel #1
0
    async def rosteradmin(self, ctx, *args):

        if args[0].lower() == 'count':
            if perms.check(ctx.message.author, self.lvl):
                await self.bot.say(ctx.message.author.mention + ' ' +
                                   f.Roster_Count())
                return

        if args[0].lower() == 'noserver':
            if perms.check(ctx.message.author, self.lvl):
                if len(args) == 2:
                    msg = f.Admin_Add_To_Roster(args[1])
                    if msg == '':
                        await self.bot.say(':white_check_mark: Successfully initiated '+\
                                           ctx.message.author.mention)
                    else:
                        await self.bot.say(':x: ' +
                                           ctx.message.author.mention + msg)
                else:
                    await self.bot.say(':x: '+ ctx.message.author.mention+\
                                        ' command contained too many arguments'+\
                                        ' or too little arguments.')
            return

        if args[0] == 'add':
            if perms.check(ctx.message.author, self.lvl):
                try:
                    user = ctx.message.mentions[0]
                except:
                    await self.bot.say(':x: must mention user to add')
                    return
                if len(args) > 2 and args[1].lower() == 'gt':

                    if len(args) > 3:
                        success = f.Add_Gamertag(user, args[3::], admin=True)
                        if not success:
                            await self.bot.say(':x: '+ ctx.message.author.mention+\
                                            ' You have not added yourself to the roster yet.')
                            return
                    else:
                        await self.bot.say(':x: '+ ctx.message.author.mention+\
                                           ' Must include your Gamertag as final argument.')
                        return
                else:
                    success, badArg = f.Add_To_Roster(user,
                                                      args[1::],
                                                      admin=True)

                # If changes are successful or not
                if success:
                    await self.bot.say(':white_check_mark: Successfully initiated '+\
                                        ctx.message.author.mention)
                else:
                    await self.bot.say(':x: '+ ctx.message.author.mention+\
                                  ' command contained invalid argument <'+\
                                    badArg+'>. Please try again.')
Beispiel #2
0
async def ban(ctx, userName2: discord.User):

            if not perms.check(ctx.message.author, 2):

                await client.say ("Your are not allowed to access this command!")
                return

            if perms.check(userName2, 2):

                await client.say ("Your are not allowed to ban this user!")
                return

            ban_msg = userName2.mention + " has been banned, due to violation of the rules in " + CHANNEL_RULES
            await client.say(ban_msg)
            await client.ban(userName2, delete_message_days=7)
            await client.unban(userName2.server, userName2)
            print('Ban was executed!')
Beispiel #3
0
 async def clear(self, ctx, number):
     if not perms.check(ctx.message.author, self.lvl):
         err = ctx.message.author.mention + 'You do not have permission to use this command.'
         await self.bot.say(err)
         return
     number = int(number) + 1
     counter = 0
     count = 0
     async for x in self.bot.logs_from(ctx.message.channel, limit = number):
         count += 1
         if counter < number:
             await self.bot.delete_message(x)
             counter += 1
Beispiel #4
0
    async def announce(self, ctx):

        if not onoff.check('announcements', CLNSERVERS['Ex Aspera Ad Astra']):
            return

        if not perms.check(ctx.message.author, self.lvl):
            await self.bot.say(ctx.message.author +\
            ', You do not have permission to use this command.')
            return

        chnl = self.bot.get_channel(CHANNELS['ANNOUNCEMENTSCHNL'])
        await self.bot.send_file(chnl, './img/announcements.png')
        await self.bot.say(ctx.message.author.mention +
                           ", Announcement image has been posted to " +
                           chnl.mention)
Beispiel #5
0
async def ex(message, client):
    if not perms.check(message.author):
        await client.send_message(
            message.channel,
            embed=discord.Embed(
                color=discord.Color.red(),
                description=(
                    "Sorry, but you need to have role `%s` to use this command!"
                    % STATICS.PERMS_ROLE_1)))
    else:
        subprocess.Popen(["bash", "restart.sh"])
        await client.send_message(message.channel,
                                  embed=discord.Embed(
                                      description="Restarting zekroBot...",
                                      colour=discord.Color.green()))
Beispiel #6
0
async def ex(message, client):
    if not perms.check(message.author):
        await client.send_message(
            message.channel,
            embed=discord.Embed(
                color=discord.Color.red(),
                description=(
                    "Sorry, but you need to have role `%s` to use this command!"
                    % STATICS.PERMS_ROLE_1)))
    elif message.content.replace(STATICS.PREFIX + "mute ", "") == "list":
        muted_str = "\n".join([
            get_member(line, message.server).name
            for line in get_mutes(message.server)
        ]) if len(get_mutes(message.server)) > 0 else "no one"
        await client.send_message(
            message.channel,
            embed=discord.Embed(description="**MUTED MEMBERS\n\n**" +
                                muted_str))
    elif len(message.mentions) < 1:
        await client.send_message(
            message.channel,
            embed=discord.Embed(
                color=discord.Color.red(),
                description="Please mention the user you want to mute!"))
    elif get_mutes(message.server).__contains__(message.mentions[0].id):
        rem_mute(message.mentions[0], message.server)
        await client.send_message(
            message.channel,
            embed=discord.Embed(
                color=discord.Color.green(),
                description=(
                    "%s got unmuted by %s." %
                    (message.mentions[0].mention, message.author.mention))))
    else:
        add_mute(message.mentions[0], message.server)
        await client.send_message(
            message.channel,
            embed=discord.Embed(
                color=discord.Color.orange(),
                description=(
                    "%s got muted by %s." %
                    (message.mentions[0].mention, message.author.mention))))
Beispiel #7
0
async def ex(message, client):
    if not perms.check(message.author):
        await client.send_message(
            message.channel,
            embed=discord.Embed(
                color=discord.Color.red(),
                description=(
                    "Sorry, but you need to have role `%s` to use this command!"
                    % STATICS.PERMS_ROLE_1)))
    elif message.server.get_member(
            "272336949841362944").status.__str__() != "offline":
        text = "zekroBot is currently online. Please dont start the bot if its still online.\nIf zekroBot is not reaction to commands, please use `!restart` command."
        await client.send_message(message.channel,
                                  embed=discord.Embed(
                                      description=text,
                                      colour=discord.Color.red()))
    else:
        subprocess.Popen(["bash", "start.sh"])
        await client.send_message(message.channel,
                                  embed=discord.Embed(
                                      description="Starting zekroBot...",
                                      colour=discord.Color.green()))
Beispiel #8
0
    async def member(self, ctx, *args):

        caller = ctx.message.author

        # PERMS CHECK
        if not perms.check(caller, self.lvl):
            err = caller.mention + 'You do not have permission to use this command.'
            await self.bot.say(err)
            return

        #BUILD USERNAME
        arg1 = ''
        for i in range(len(args)):
            if i == len(args) - 1:
                arg1 += args[i]
            else:
                arg1 += args[i] + ' '
  
        #ERROR CHECKING
        if len(args) == 0:
            err = ':x: '+ctx.message.author.mention + ' Command requires user as argument.'
            await self.bot.say(err)
            return
            
        if f.Member_Obj(self.bot.get_all_members(), arg1) is None:
            err = ':x: '+ctx.message.author.mention + ', '+arg1+' is not a valid username.'
            await self.bot.say(err)
            return
        
        memb = f.Member_Obj(self.bot.get_all_members(), arg1)
        details = '\nFor User: **'+arg1+'**\n'
        details += '```NAME: ' + memb.name + '\n'
        details += 'ID#:' + memb.id + '\n'
        details += 'ACCOUNT ACTIVATED:' + str(memb.created_at) + '\n'
        details += 'NICKNAME:' + memb.display_name + '```'
        await self.bot.say(details)
Beispiel #9
0
    async def reset(self, ctx):

        if not onoff.check('announcements', CLNSERVERS['Ex Aspera Ad Astra']):
            return

        if not perms.check(ctx.message.author, self.lvl):
            await self.bot.say(ctx.message.author +\
            ', You do not have permission to use this command.')
            return
        val4 = val5 = 'n'

        try:
            # Questions/Responses
            await self.bot.say('I sent you a private message <@'+\
              str(ctx.message.author.id)+'> about setting up the **Weekly Reset**.')

            await self.bot.send_message(ctx.message.author, 'The following '+\
                     'questions will help you set up the **Weekly Reset** message. '+\
                     'simply dont respond to the prompts - after 2mins, the command will quit.')

            await self.bot.send_message(ctx.message.author,
                                        'Enter the date of this reset: ')
            val1 = await self.bot.wait_for_message(timeout=120.0,
                                                   author=ctx.message.author)
            #Check for reply
            if val1 == None:
                await self.bot.say('<@'+str(ctx.message.author.id)+'> you did not '+\
                                   'respond in time. Please try the command again.')
                return

            await self.bot.send_message(ctx.message.author,
                                        'Enter url for weekly reset image: ')
            val2 = await self.bot.wait_for_message(timeout=120.0,
                                                   author=ctx.message.author)
            #Check for reply
            if val2 == None:
                await self.bot.say('<@'+str(ctx.message.author.id)+'> you did not '+\
                                   'respond in time. Please try the command again.')
                return

            await self.bot.send_message(
                ctx.message.author, 'Enter url for reset guide (general): ')
            val3 = await self.bot.wait_for_message(timeout=120.0,
                                                   author=ctx.message.author)
            #Check for reply
            if val3 == None:
                await self.bot.say('<@'+str(ctx.message.author.id)+'> you did not '+\
                                   'respond in time. Please try the command again.')
                return

            # Optional information
            await self.bot.send_message(
                ctx.message.author,
                'Want to include raid challenge video[yes/no]?: ')
            res = await self.bot.wait_for_message(timeout=120.0,
                                                  author=ctx.message.author)

            if (res.content).lower() == 'yes':
                await self.bot.send_message(ctx.message.author,
                                            'Input video url: ')
                val4 = await self.bot.wait_for_message(
                    timeout=120.0, author=ctx.message.author)
            else:
                if (res.content).lower() != 'no':
                    await self.bot.say('<@'+str(ctx.message.author.id)+'> you did not '+\
                                   'respond in time. Please try the command again.')
                    return

            await self.bot.send_message(
                ctx.message.author,
                'Want to include nightfall video[yes/no]?: ')
            res = await self.bot.wait_for_message(timeout=120.0,
                                                  author=ctx.message.author)

            if (res.content).lower() == 'yes':
                await self.bot.send_message(ctx.message.author,
                                            'Input video url: ')
                val5 = await self.bot.wait_for_message(
                    timeout=120.0, author=ctx.message.author)
            else:
                if (res.content).lower() != 'no':
                    await self.bot.say('<@'+str(ctx.message.author.id)+'> you did not '+\
                                    'respond in time. Please try the command again.')
                    return

            val6 = []
            val7 = []
            val8 = []
            # Additional information to include - not standard reset
            while (True):
                await self.bot.send_message(
                    ctx.message.author, 'Anything else this week?[yes/no]: ')
                res = await self.bot.wait_for_message(
                    timeout=120.0, author=ctx.message.author)

                if (res.content).lower() == 'yes':
                    val6.append(True)
                    await self.bot.send_message(ctx.message.author, 'Title: ')
                    val7.append((await self.bot.wait_for_message(
                        timeout=120.0, author=ctx.message.author)).content)
                    await self.bot.send_message(ctx.message.author,
                                                'Url for guide/info: ')
                    val8.append((await self.bot.wait_for_message(
                        timeout=120.0, author=ctx.message.author)).content)
                else:
                    val6.append(False)
                    break

            desc = 'Check out this [Weekly Reset Guide](' + val3.content + ') for more info'
            embed = discord.Embed(title=':high_brightness: __**Everything you need '+\
                    'to know, right here!**__ :high_brightness:', description=desc, color=1234123)
            embed.set_author(name='Destiny 2', icon_url=DESTICON)

            # Add in any optional fields requested
            if val4 != 'n':
                if val5 != 'n':
                    embed.add_field(name="Raid Challenge Video",
                                    value='[Challenge](' + val4.content +
                                    ') video')
                else:
                    embed.add_field(name="Raid Challenge Video",
                                    value='[Challenge](' + val4.content +
                                    ') video',
                                    inline=False)
            if val5 != 'n':
                if val4 != 'n':
                    embed.add_field(name="Nightfall Video",
                                    value='[Nightfall](' + val5.content +
                                    ') video')
                else:
                    embed.add_field(name="Nightfall Video",
                                    value='[Nightfall](' + val5.content +
                                    ') video',
                                    inline=False)

            # Add in additional fields not standars to regular weekly reset
            i = 0
            while (val6[i]):
                embed.add_field(name=val7[i], value='**' + val8[i] + '**!')
                i = i + 1

            # Finish embedded messaged
            embed.set_image(url=val2.content)
            embed.set_footer(text='Ex Aspera Ad Astra', icon_url=DESTICON)

            await self.bot.send_message(ctx.message.author,
                                        "Here is your message:")
            await self.bot.send_message(ctx.message.author,
                                        '**Weekly Reset: ' + val1.content +
                                        '**',
                                        embed=embed)
            await self.bot.send_message(ctx.message.author,
                                        "type **confirm** or **cancel**")
            res = await self.bot.wait_for_message(timeout=120.0,
                                                  author=ctx.message.author)
            if (res.content).lower() == 'confirm':
                await self.bot.send_message(
                    ctx.message.author,
                    "Reset has been posted to #weekly-events-and-reset")
                await self.bot.send_file(
                    self.bot.get_channel(CHANNELS['WEEKLYRESETCHNL']),
                    './img/weeklyReset.png')
                await asyncio.sleep(4)
                await self.bot.send_message(
                    self.bot.get_channel(CHANNELS['WEEKLYRESETCHNL']),
                    '@everyone **Weekly Reset: ' + val1.content + '**',
                    embed=embed)
            else:
                await self.bot.send_message(ctx.message.author,
                                            "Message **cancelled**.")
        except:
            err = '**::SOMETHING WENT WRONG::**\n**Error**: Request caused 404 error \n'
            err = 'Check your links, when it asks for a video link, and reset guide link, '
            err = 'an image link, etc., you must provide a full URL.\n'
            await self.bot.send_message(ctx.message.author, err)
Beispiel #10
0
    async def clanreward(self, ctx, arg=None):

        if not onoff.check('announcements', CLNSERVERS['Ex Aspera Ad Astra']):
            return

        # ERROR CHECKING: Must be Admin
        if not perms.check(ctx.message.author, self.lvl):
            await self.bot.say(ctx.message.author +\
            ', You do not have permission to use this command.')
            return

        if arg != None:
            # some variables to make things easy
            engram = 'http://exo-boost.com/images/stories/virtuemart/product/legenary.png'
            chnl = self.bot.get_channel(CHANNELS['ANNOUNCEMENTSCHNL'])

            msg = '@everyone **New Clan Reward Incoming**'
            desc = '**New Clan Rewards** available from **Hawthorne**! \U0001f603 '
            embed = discord.Embed(title="", description=desc, color=000000)
            embed.set_author(name='Clan Engrams', icon_url=engram)

            # Customize embed based on arg value
            if arg.lower() == 'raid':
                embed.add_field(name='__Leviathan Raid__', value='Complete ')
                embed.add_field(name='__Reward__',
                                value='Luminous Engram :crossed_swords: ')
                embed.set_image(url=RAIDIMG)

            elif arg.lower() == 'crucible':
                embed.add_field(name='__Crucible__', value='Complete')
                embed.add_field(name='__Reward__',
                                value='Luminous Engram :crossed_swords: ')
                embed.set_image(url=CRUCIMG)

            elif arg.lower() == 'nightfall':
                embed.add_field(name='__Nightfall__', value='Complete')
                embed.add_field(name='__Reward__',
                                value='Luminous Engram :crossed_swords: ')
                embed.set_image(url=NFALLIMG)

            elif arg.lower() == 'trials':
                embed.add_field(name='__Trials of the Nine__',
                                value='Complete')
                embed.add_field(name='__Reward__',
                                value='Luminous Engram :crossed_swords: ')
                embed.set_image(url=TRIALSIMG)

            elif arg.lower() == 'gambit':
                embed.add_field(name='__Gambit__', value='Complete')
                embed.add_field(name='__Reward__',
                                value='Luminous Engram :crossed_swords: ')
                embed.set_image(url=GAMBITIMG)

            else:
                err = ' :x:  argument not valid. Must be (raid, nightfall, trials, gambit, or crucible).'
                await self.bot.say(ctx.message.author.mention + err)
                return

            # confirm to user and finish embed
            conf = ':white_check_mark: Reward message initiated'
            await self.bot.say(ctx.message.author.mention + conf)
            embed.set_footer(text='Ex Aspera Ad Astra | Clan Reward',
                             icon_url=DESTICON)
            await self.bot.send_message(chnl, msg, embed=embed)

        # ERROR CHECKING: Command requires argument
        else:
            err = ' :x:  command requires argument (raid, nightfall, trials, or crucible).'
            await self.bot.say(ctx.message.author.mention + err)
Beispiel #11
0
def on_message(message):
    if message.attachments:        
        yield from client.add_reaction(message, '\U0001F44D')
    #Teamzuordnung
    if message.content.startswith(prefix):
        invoke = message.content[len(prefix):].split(" ")[0]
        args = message.content.split(" ")[1:]
        if commands.__contains__(invoke):
            cmd = commands[invoke]
            try:
                if not perms.check(message.author, cmd.perm):
                    yield from client.send_message(message.channel, embed=Embed(color=discord.Color.red(), description=("Du kannst dich nicht zwei Teams zuordnen!" % invoke)))
                    return
                yield from cmd.ex(args, message, client, invoke)
            except:
                cmd.ex(args, message, client, invoke)
                pass

        
            
        #membercount
        elif message.content.startswith(prefix+'membercount') or message.content.startswith(prefix+'Membercount'):
            current =  datetime.datetime.now()
            now = current.strftime ("%Y-%m-%d, um %H:%M:%S Uhr")

            #listen initialisieren
            InstinctMembers = [ ]
            MysticMembers = [ ]
            ValorMembers = [ ]
            BotMembers = [ ]
           
            x = message.server.members
            for member in x:
                #print(member.name)
                for role in member.roles:
                    if role.id=='339715070114136065': #instinct
                        InstinctMembers.append(member.name)
                    elif role.id=='339715116541149186': #mystic
                        MysticMembers.append(member.name)
                    elif role.id=='339715177635250177': #valor
                        ValorMembers.append(member.name)
                    elif role.id=='332139679883198465': #bots
                        BotMembers.append(member.name)
                    
          
            InstinctCount = len(InstinctMembers)
            #print('Instinct: \n' + str(InstinctMembers))
            print(InstinctCount)
            
            MysticCount = len(MysticMembers)
            #print('Mystic: \n' + str(MysticMembers))
            print(MysticCount)
            
            ValorCount = len(ValorMembers)
            #print('Valor: \n' + str(ValorMembers))
            print(ValorCount)

            BotCount = len(BotMembers)
            #print('Bots: \n' + str(BotMembers))
            print(BotCount)
            
            embed=Embed(
                   color=discord.Color.green()   ,
                   description=("**Trainer gesamt:**  %s \n**<:instinct:410759229473947649> Instinct:** %s \n**<:mystic:365202251691851786> Mystic:** %s \n**<:valor:410759232334462977> Valor:** %s \n\n**Bots:** %s  \n\nam %s" % (message.server.member_count, InstinctCount, MysticCount, ValorCount, BotCount , now))
                   

                )
            embed.set_author(name="PokéGo MS" , icon_url="https://www.pokewiki.de/images/9/96/Sugimori_001.png")
            
            yield from client.send_message(message.channel, embed=embed)

  
        #ich mag pokemon
        elif message.content.startswith(prefix+'ich mag pokemon') or message.content.startswith(prefix+'ich mag Pokemon') or message.content.startswith(prefix+'Ich mag Pokemon'):
            yield from client.add_reaction(message, '\U0001F44D')
            yield from client.send_message(message.channel, 'Ich auch :slight_smile: ')
            yield from client.send_message(message.channel, 'https://giphy.com/gifs/ash-s9x3racq2ZL5m ')
        #attack
        elif message.content.startswith(prefix+'attack') or message.content.startswith(prefix+'Attack'):
            random_attack = random.choice(open("Attacks.txt").readlines())
            print(random_attack)
            yield from client.send_message(message.channel, random_attack)
            
        #wunsch        
        elif message.content.startswith(prefix+'wunsch') or message.content.startswith(prefix+'Wunsch'): 
            current =  datetime.datetime.now()
            now = current.strftime ("[%d-%m-%Y / %H:%M:%S Uhr]")
               
            file = open("wishes.txt","a")                        
            file.write("Wunsch: " + message.content[8:] + now + " (" + str(message.author) + ") " + "\n")
                
            file.close()
            yield from client.send_message(message.channel, 'Danke! Dein Wunsch wurde entgegengenommen :smiley: ')

        #liste
        elif message.content.startswith(prefix+'liste') or message.content.startswith(prefix+'Liste'):
            file = open("wishes.txt","r")
            yield from client.send_message(message.channel, embed=Embed(color=discord.Color.orange(), description=(file.read())))            
            file.close()
            
        #spawns
        elif message.content.startswith(prefix+'spawns') or message.content.startswith(prefix+'Spawns'):
            s = open("spawns.txt","r")
            yield from client.send_message(message.channel, embed=Embed(color=discord.Color.orange(), description=(s.read())))            
            s.close()

        #raids
        elif message.content.startswith(prefix+'raids') or message.content.startswith(prefix+'Raids'):
            r = open("raids.txt","r")
            yield from client.send_message(message.channel, embed=Embed(color=discord.Color.orange(), description=(r.read())))            
            r.close()        

        #help
        elif message.content.startswith(prefix+'help') or message.content.startswith(prefix+'Help'):
            yield from client.send_message(message.channel, embed=Embed(color=discord.Color.orange(), description=("Es gibt folgende Befehle: \n\n**$team [Teamname]**: Fügt dich einem Team hinzu \n**$raids**: Sagt dir, welche Raids in den Raidkanälen durchgegeben werden\n**$spawns**: Sagt dir, welche wilden Pokémon in den Spawnkanälen durchgegeben werden\n**$ich mag pokemon**: Gibt dir eine Antwort \n**$attack**: Gibt eine zufällige Attacke zurück \n**$wunsch [beliebiger Inhalt]**: Wünsche dir etwas, was du in Zukunft gerne auf dem Server/Map hättest! \n**$liste**: Gibt dir eine Liste, was bisher schon gewünscht wurde \n**$membercount**: Gibt aus, wie viele User auf dem Server sind \n**$invite**: Schickt dir per PN eien Invite-Link für den Server" )))

        #invite
        elif message.content.startswith(prefix+'invite') or message.content.startswith(prefix+'Invite'):
            embed=Embed(
                   color=discord.Color.green()   ,
                   description=("Hey " + message.author.name +"!\n\n**mit diesem Link kommt man auf den Server:**  \nhttps://discord.gg/QEXfBJB \n**Discord im Apple App Store:** \nhttps://itunes.apple.com/de/app/discord/id985746746?mt=8 \n**Discord im Google Play Store:** \nhttps://play.google.com/store/apps/details?id=com.discord&hl=de ")
                )
            embed.set_author(name="PokéGo MS" , icon_url="https://www.pokewiki.de/images/9/96/Sugimori_001.png")
            yield from client.send_message(message.author, embed=embed)
            yield from client.send_message(message.channel, "Ich habe dir eine PN geschickt " + message.author.name + " :wink:")
        
       #Errorcode
        else:
            yield from client.send_message(message.channel, embed=Embed(color=discord.Color.red(), description=("Dieser Befehl `%s` ist nicht gültig!" % invoke)))
Beispiel #12
0
async def on_message(message):

    # print(message.channel.name)
    # print(message.author.name)
    conn = sqlite3.connect('sql.db')
    c = conn.cursor()
#start custom filtering for nebula

#end of custom filtering for nebula

    if message.content.startswith("<@!%s>" % (client.user.id)):
        await embeds.pingmsg(message, client)

    if message.content.startswith("<@%s>" % (client.user.id)):
        await embeds.pingmsg(message, client)

# FILTER PART
#    if not 0==0:
    if not perms.check(message.author, 1):
        kran = 0


        c.execute("SELECT * FROM chatfilter WHERE id = '%s'" % (message.server.id))
        row = c.fetchone()

        if not row:
            c.execute("INSERT INTO chatfilter (id, filtered, active) VALUES ('%s', '7890798078978097987980978798008087707908', '1') " % (message.server.id))
            conn.commit()

        else:
#            print(row)
            filtered = row[1]
#            print(filtered)
#            print("FILTERED DECODED")
#            print(filtered)
#            print("DONE")
            filteredsplit = filtered.split(',')
#            print(filteredsplit)
            for f in filteredsplit:
#                print(f)
                if not f == "7890798078978097987980978798008087707908":
                    if not kran == 1:
                        if not message.content.lower().find(f) == -1:
                            try:
                                await embeds.filteredlog(message, client)
                            except:
                                await embeds.nologchan(message, client)
                            await client.delete_message(message)
                            await embeds.sorrymsg(message, client)
                            kran = 1
    conn.close()
#FILTER PART END

    #print(message.server.id)
    if message.content.lower().startswith(config.prefix):
        invoke = message.content[len(config.prefix):].split(" ")[0].lower()
        args = message.content.split(" ")[1:]
        #print("INVOKE %s\nARGS: %s" % (invoke, args.__str__()[1:-1].replace ("'", "")))
        if commands.__contains__(invoke):

            cmd = commands[invoke]
            try:
                if not perms.check(message.author, cmd.perm):
                    await embeds.noperms(message, client, invoke)
                    return
                await cmd.ex(args, message, client, invoke)
            except:
                await cmd.ex(args, message, client, invoke)
                pass

            # await commands.get(invoke).ex(args, message, client, invoke)
        else:
            await embeds.unknowncmd(message, client, invoke)
    return
Beispiel #13
0
    async def activity(self, ctx, arg1='', arg2=''):
        
        memb = ctx.message.author
        
        # PERMS CHECK
        if not perms.check(memb, self.lvl):
            err = memb.mention + 'You do not have permission to use this command.'
            await self.bot.say(err)
            return
        
        #ERROR CHECKING
        try:
            if arg1.lower() != 'full':
                int(arg1)
            if arg2.lower() != 'week' and arg2.lower() != 'weeks':
                err = ':x: '+memb.mention+', arg2 must be week or weeks.'
                await self.bot.say(err)
                return
        except:
            err = ':x: '+memb.mention+', arg1 must be integer in this form.'
            await self.bot.say(err)
            return

        #variables
        mcount = 0
        num_msgs = 0
        desc = []
        membersList = []
        target = datetime.datetime.today() - datetime.timedelta(days=7*float(arg1))
        members = set(self.bot.get_all_members())
        
        # let user know you got message, and begin loading
        tempmsg = await self.bot.say(memb.mention+', give me a moment....')
        insert = str(mcount)+'/'+str(len(members)-6)
        msg = await self.bot.send_message(ctx.message.channel,'Checking member `<'+insert+'>`')

        # MEMBER LOOP: Find all members messages after given
        #              target date in each channel.
        break_flag    = False
        user_inactive = True
        for m in members:
            num_msgs = 0
            if not f.Is_Bot(m) and m != self.eaaat:
                mcount += 1
                insert = '`<'+str(mcount)+'/'+str(len(members)-6)+'>`'
                await self.bot.edit_message(msg,'Checking member '+insert+'... ...')
                break_flag = False
                user_inactive = True
                for k in ACTIVECHANNELS:
                    chnl = self.bot.get_channel(ACTIVECHANNELS[k])
                    async for message in self.bot.logs_from(chnl, after=target, limit=3000):
                        if message.author == m:
                            num_msgs += 1
                            if num_msgs > 1:
                                break_flag = True
                                user_inactive = False
                                break
                    if break_flag:
                        break
                if user_inactive:
                    membersList.append(m.name)

        # PREPARE RESULTS
        i = 0
        count = 0
        membersList.sort(key=str.lower)
        if len(membersList) > 0:
            desc.append('')
            for m in membersList:
                count += 1
                desc[i] += '**×** '+m+'\n'
                if count == 15:
                    desc.append('')
                    i += 1
                    count == 0

        #PAGINATION VARIABLES
        pgs = str(i + 1)
        r = [self.stop]
        i = 0
        
        # Prepare first page of activity report
        await self.bot.delete_message(tempmsg)
        await self.bot.delete_message(msg)
        await self.bot.say(memb.mention+', Activity is now ready to view below.')
        embed = discord.Embed(title='', description=desc[0], color=1234123)
        embed.set_author(name='Ex Aspera Ad Astra Activity Report', icon_url= CLANICONWHT)
        embed.set_thumbnail(url = CLANICONWHT)
        txt = 'Activity Report | Option: '+arg1+' '+arg2+' | page 1'+'/'+pgs
        embed.set_footer(text=txt,icon_url=CLANICONWHT)
        msg = await self.bot.send_message(ctx.message.channel, embed=embed)

        # Add reactions
        await self.bot.add_reaction(msg,self.stop)
        if len(desc) > 1:
            r.append(self.next)
            await self.bot.add_reaction(msg,self.next)
                
        # get response
        res = await self.bot.wait_for_reaction(message=msg, timeout=60)

        # BEGIN PAGINATION: This while loop will handle viewing
        #                   of the roster show command until the end
        try:
            while res.reaction.emoji != self.stop or res.user != memb:
                
                # NEXT page~~
                if res.reaction.emoji == self.next and res.user == memb and f.available(self.next, r):
                    i += 1
                    r = []
                    txt = 'Activity Report | Option: '+arg1+' '+arg2+' | page '+str(i+1)+'/'+pgs
                    embed = discord.Embed(title='', description=desc[i], color=1234123)
                    embed.set_author(name='Ex Aspera Ad Astra Activity Report', icon_url= CLANICONWHT)
                    embed.set_thumbnail(url = CLANICONWHT)
                    embed.set_footer(text=txt,icon_url=CLANICONWHT)
                    msg = await self.bot.edit_message(msg, embed=embed)
                    await self.bot.clear_reactions(msg)
                    
                    # Add reactions
                    await self.bot.add_reaction(msg,self.prev)
                    await self.bot.add_reaction(msg,self.stop)
                    if len(desc) > i + 1:
                        r.append(self.next)
                        await self.bot.add_reaction(msg,self.next)
                    r.append(self.prev)
                    
                # PREV page~~
                elif res.reaction.emoji == self.prev and res.user == memb and f.available(self.prev, r):
                    i -= 1
                    r = []
                    txt = 'Activity Report | Option: '+arg1+' '+arg2+' | page '+str(i+1)+'/'+pgs
                    embed = discord.Embed(title='', description=desc[i], color=1234123)
                    embed.set_author(name='Ex Aspera Ad Astra Activity Report', icon_url= CLANICONWHT)
                    embed.set_thumbnail(url = CLANICONWHT)
                    embed.set_footer(text=txt,icon_url=CLANICONWHT)
                    msg = await self.bot.edit_message(msg, embed=embed)
                    await self.bot.clear_reactions(msg)
                    
                    # Add reactions
                    if i != 0:
                        r.append(self.prev)
                        await self.bot.add_reaction(msg,self.prev)
                    await self.bot.add_reaction(msg,self.stop)
                    await self.bot.add_reaction(msg,self.next)
                    r.append(self.next)
                    
                # Un-approved emoji reaction
                # or user other than memb & EAAA
                else:
                    if res.user != self.eaaa and res.user != self.eaaat:
                        await self.bot.remove_reaction(msg, res.reaction.emoji, res.user)
                    
                # get next reaction based on current page.
                if i == 0:
                    res = await self.bot.wait_for_reaction(message=msg, timeout=60)
            
                elif i == len(desc) - 1:
                    res = await self.bot.wait_for_reaction(message=msg, timeout=60)
                    
                else:
                    res = await self.bot.wait_for_reaction(message=msg, timeout=60)
            
                # Timeout
                if res is None:
                    break
        except:
            do_nothing = ''

        # End session on first page
        await self.bot.clear_reactions(msg)
        embed = discord.Embed(title='', description=desc[0], color=1234123)
        embed.set_author(name='Ex Aspera Ad Astra Activity Report', icon_url= CLANICONWHT)
        embed.set_thumbnail(url = CLANICONWHT)
        txt = text='Activity Report | Option: '+arg1+' '+arg2+' | Session Ended'
        embed.set_footer(text=txt,icon_url=CLANICONWHT)
        msg = await self.bot.edit_message(msg, embed=embed)
        return
Beispiel #14
0
    async def ascended(self, ctx, *args):
        
        # check for ovveride in arguments
        override = False
        for a in args:
            if a.lower() == 'override' and ctx.message.author.name == 'Bop':
                args = args[:-1]
                override = True
        
        #BUILD USERNAME
        arg1 = ''
        for i in range(len(args)):
            if i == len(args) - 1:
                arg1 += args[i]
            else:
                arg1 += args[i] + ' '

        #PERMS CHECK
        if not perms.check(ctx.message.author, self.lvl):
            err = ctx.message.author.mention + ' You do not have permission to use this command.'
            await self.bot.say(err)
            return
        
        #ERROR CHECKING
        if len(args) == 0:
            err = ':x: '+ctx.message.author.mention + ' Command requires user as argument.'
            await self.bot.say(err)
            return
        if f.Member_Obj(self.bot.get_all_members(), arg1) is None:
            err = ':x: '+ctx.message.author.mention + ', '+arg1+' is not a valid username.'
            await self.bot.say(err)
            return
        
        # variables
        roles = ctx.message.server.roles
        ascendedRole = f.Role_Obj(roles, 'Ascended')
        ascendedMemb = f.Member_Obj(self.bot.get_all_members(), arg1)
        cont = False
        await self.bot.say(ctx.message.author.mention+', I sent you a pm.')

        # PERFORM AUTOCHECKS
        msg = f.Ascended_Check(1,arg1, '')
        botmsg = await self.bot.send_message(ctx.message.author,msg)
        await asyncio.sleep(5.0)
        grO, grS = f.Get_Guided_Roles(ascendedMemb)
        if len(grO) > 0:
            cont = True
            msg = f.Ascended_Check(2,arg1,':white_check_mark:')
            botmsg = await self.bot.edit_message(botmsg,msg)
        else:
            msg = f.Ascended_Check(2,arg1, ':x:')
            botmsg = await self.bot.edit_message(botmsg,msg)
            err = '\nUser does not have any **guidedroles**, and therefore does '
            err += 'not qualify for the role of **Ascended**.\n'
            err += ':x: **Submission Denied**'
            await self.bot.send_message(ctx.message.author,err)
            return

        if cont:
            await asyncio.sleep(5.0)
            cont = False
            if f.User_Joined_By(ascendedMemb, 28) or override:
                cont = True
                msg = f.Ascended_Check(3,arg1,':white_check_mark:')
                botmsg = await self.bot.edit_message(botmsg,msg)
            else:
                msg = f.Ascended_Check(3,arg1,':x:')
                botmsg = await self.bot.edit_message(botmsg,msg)
                err = '\nUser has not been in the clan for a minimum time '
                err += 'of **1 month**, and therefore does '
                err += 'not qualify for the role of **Ascended**.\n'
                err += ':x: **Submission Denied**'
                await self.bot.send_message(ctx.message.author,err)
                return

        if cont:
            cont = False
            break_flag = False
            target = datetime.datetime.today() - datetime.timedelta(days=7)
            for k in ACTIVECHANNELS:
                chnl = self.bot.get_channel(ACTIVECHANNELS[k])
                async for message in self.bot.logs_from(chnl, after=target, limit=2000):
                    if message.author == ascendedMemb:
                        break_flag = True
                        cont = True
                        break
                if break_flag:
                    break

        if cont:
            msg = f.Ascended_Check(4,arg1,':white_check_mark:')
            await asyncio.sleep(3.0)
            botmsg = await self.bot.edit_message(botmsg,msg)
            await asyncio.sleep(3.0)
        else:
            msg = f.Ascended_Check(4,arg1,':x:')
            botmsg = await self.bot.edit_message(botmsg,msg)
            err = '\nUser has not been **active** enough on **discord**, '
            err += 'and therefore does not qualify for the role of **Ascended**.\n'
            err += ':x: **Submission Denied**'
            await self.bot.send_message(ctx.message.author,err)
            return

        # CHECKS SUCCESSFULL, SEND REST OF MESSAGE
        msg = '\n:white_check_mark: Checks **sucessful**, the rest must be '
        msg += 'confirmed by you manually..\n'
        msgtemp = '**Just a moment... ... ...**'
        botmsg = await self.bot.send_message(ctx.message.author,msg+msgtemp)
        await asyncio.sleep(5.0)
        msg = '\nThe bold statements above are required. If '+arg1+' qualifies for '
        msg += 'at least **6/7** of the above criteria, then they are qualified '
        msg += 'for the ascended role.\nYou can respond with **confirm** or **cancel**.'
        await self.bot.edit_message(botmsg,msg)
        resp = await self.bot.wait_for_message(timeout=120.0, author=ctx.message.author)

        if resp is None:
            err = '**:x: Command timedout. Please try again.**'
            await self.bot.send_message(ctx.message.author,err)
            return

        # Confirm nomination, begin process of nomination
        if resp.content.lower() == 'confirm':

            chnl = self.bot.get_channel(CHANNELS['ADMINCHATCHNL'])
            responder = f.Member_Obj(self.bot.get_all_members(), resp.author.name)
            
            # non-Founders must have a second confirm nomination
            if not f.Member_Is_Role(responder, 'Founder'):
                msg = 'Thank you,\nTo continue, another Admin must confirm the nomination. '
                msg += 'We have sent a message to Admin-Chat stating this.'
                await self.bot.send_message(ctx.message.author,msg)
                admsg = f.Role_Obj(roles, 'Admin').mention+',\n\n'
                admsg += ctx.message.author.mention + ' has nomiminated **' + arg1
                admsg += '** for the role of '+f.Role_Obj(roles, 'Ascended').mention
                admsg += '.\nWe require **one additional **'+ f.Role_Obj(roles, 'Admin').mention
                admsg += ' to confirm this nomination to continue.\n\nPlease send the '
                admsg += 'message ***"confirm '+arg1+'"*** to validate this nomination.'
                await self.bot.send_message(chnl,admsg)
                
                # Check admin-chat for second admin confirmation
                while True:
                    resp = await self.bot.wait_for_message(timeout=300.0, channel=chnl)
                    if resp.content.lower() == 'confirm '+arg1.lower():
                        if f.Member_Is_Role(resp.author, 'Admin'):
                            if resp.author != ctx.message.author or resp.author.name == 'Bop':
                                msg = f.Ascended_Message(ascendedMemb)
                                await self.bot.send_file(ascendedMemb, 'img/ascended.png')
                                await self.bot.send_message(ascendedMemb,msg)
                                conf = f.Role_Obj(roles, 'Admin').mention + ' **"'+arg1+'"** '
                                conf += 'has been sent a message informing them of their '
                                conf += 'nomination for '+ascendedRole.mention+'.'
                                await self.bot.send_message(chnl,conf)
                                return
                    # timeout
                    if resp is None:
                        tout = ctx.message.author.mention + ', there was no response '
                        tout += 'from another admin. Please try again later.'
                        await self.bot.send_message(chnl,tout)
                        return

            # Founder responsible for nomination
            else:
                msg = 'As the clan **Founder**, a *second* confirmation from another Admin '
                msg += 'is not required...\nJust a moment please...'
                await asyncio.sleep(3.0)
                await self.bot.send_message(ctx.message.author,msg)
                await self.bot.send_file(ascendedMemb, 'img/ascended.png')
                await self.bot.send_message(ascendedMemb,f.Ascended_Message(ascendedMemb))
                msg = '**There!!** Member `'+arg1+'` has been sent a message about their '
                msg += 'nomination for the role **Ascended**. a message will be sent to '
                msg += '**admin-chat** to inform the Admins.'
                await self.bot.send_message(ctx.message.author,msg)
                await asyncio.sleep(3.0)
                admsg = f.Role_Obj(roles, 'Admin').mention+',\n\n'
                admsg += ctx.message.author.mention + ' has nomiminated **' + arg1
                admsg += '** for the role of '+f.Role_Obj(roles, 'Ascended').mention
                admsg += '.\nas the clan '+ f.Role_Obj(roles, 'Founder').mention
                admsg += ', this nomination has been **automatically accepted**, and the '
                admsg += 'invite has been sent to '+arg1+'.'
                await self.bot.send_message(chnl,admsg)
        else:
            await self.bot.send_message(ctx.message.author,' The process has been cancelled.')
Beispiel #15
0
    async def roster(self, ctx, *args):

        if not onoff.check('roster', CLNSERVERS['Ex Aspera Ad Astra']):
            return

        success = True
        badArg = user = desc = ''

        # all commands require arguments of some sort
        if len(args) == 0:
            await self.bot.say(':x: '+ ctx.message.author.mention+\
                              ' Command requires argument(s).')
            return

        # FILE ~~~~~~~
        # Send roster file to admin channel,
        # assumin permission criteria is met.
        elif args[0] == 'file':
            s = ctx.message.author.mention + 'here is the file you requested'
            if perms.check(ctx.message.author, self.lvl):
                await self.bot.send_file(self.bot.get_channel(
                    CHANNELS['ADMINCHATCHNL']),
                                         'utils/roster.csv',
                                         content=s)
            else:
                await self.bot.say(':x: '+ ctx.message.author.mention+\
                        ' You do not have permission to execute this command!')

        # ADD ~~~~~~~
        # add member and/or addition info about member.
        # see Add_To_Roster in functions.py
        elif args[0] == 'add':
            if len(args) > 1 and args[1].lower() == 'gt':
                if len(args) > 2:
                    success = f.Add_Gamertag(ctx.message.author, args)
                    if not success:
                        await self.bot.say(':x: '+ ctx.message.author.mention+\
                             ' You have not added yourself to the roster yet.')
                        return
                else:
                    await self.bot.say(':x: '+ ctx.message.author.mention+\
                              ' Must include your Gamertag as final argument.')
                    return

            elif len(args) > 1 and args[1].lower() == 'note':
                if len(args) > 2:
                    success, issue = f.Add_Note(ctx.message.author, args)
                    if not success and issue == 'length':
                        await self.bot.say(':x: '+ ctx.message.author.mention+\
                          ' Note is too long. Must be less than 20 characters.')
                        return

                    success, issue = f.Add_Note(ctx.message.author, args)
                    if not success and issue == 'not found':
                        await self.bot.say(':x: '+ ctx.message.author.mention+\
                        ' You have not added yourself to the roster yet.')
                        return
                else:
                    await self.bot.say(':x: '+ ctx.message.author.mention+\
                                       ' Must include note as final argument.')
                    return

            else:
                success, badArg = f.Add_To_Roster(ctx.message.author, args)

        # SHOW ~~~~~~~
        # show clan roster, post results as paginated embed.
        # Can take query args. See Show_Roster in functions.py
        elif args[0] == 'show':
            memb = ctx.message.author
            r = [self.stop]
            i = 0

            # Gen roster shows only work for gamertag and tpref
            if len(args) == 2 and not\
                (args[1] == 'gamertag' or args[1] == 'tpref' or args[1] == 'birthday' or args[1] == 'status'):
                await self.bot.say(':x: ' + memb.mention +
                                   ' Invalid Roster Query <' + args[1] + '>.')
                return

            # Get list + info for embed
            desc, pgs, num, type = f.Show_Roster(memb, args)

            # If function returns info, make an embed!
            if desc[0] != '':
                embed = discord.Embed(title='',
                                      description=desc[0],
                                      color=1234123)
                embed.set_author(name='Ex Aspera Ad Astra Roster: ' + type,
                                 icon_url=CLANICONWHT)
                embed.set_footer(text='Total Members: ' + num + ' | page ' +
                                 '1' + '/' + pgs,
                                 icon_url=CLANICONWHT)
                msg = await self.bot.send_message(ctx.message.channel,
                                                  embed=embed)

                # Add reactions
                await self.bot.add_reaction(msg, self.stop)
                if len(desc) > 1:
                    r.append(self.next)
                    await self.bot.add_reaction(msg, self.next)

                # get response
                res = await self.bot.wait_for_reaction(message=msg, timeout=60)

                # Begin pagination.
                # This while loop will handle viewing
                # of the roster show command until the end
                try:
                    while res.reaction.emoji != self.stop or res.user != memb:

                        # NEXT page~~
                        if res.reaction.emoji == self.next and res.user == memb and f.available(
                                self.next, r):
                            i += 1
                            r = []
                            txt = 'Total Members: ' + num + ' | page ' + str(
                                i + 1) + '/' + pgs
                            embed = discord.Embed(title='',
                                                  description=desc[i],
                                                  color=1234123)
                            embed.set_author(
                                name='Ex Aspera Ad Astra Roster: ' + type,
                                icon_url=CLANICONWHT)
                            embed.set_footer(text=txt, icon_url=CLANICONWHT)
                            msg = await self.bot.edit_message(msg, embed=embed)
                            await self.bot.clear_reactions(msg)

                            # Add reactions
                            await self.bot.add_reaction(msg, self.prev)
                            await self.bot.add_reaction(msg, self.stop)
                            if len(desc) > i + 1:
                                r.append(self.next)
                                await self.bot.add_reaction(msg, self.next)
                            r.append(self.prev)

                        # PREV page~~
                        elif res.reaction.emoji == self.prev and res.user == memb and f.available(
                                self.prev, r):
                            i -= 1
                            r = []
                            txt = 'Total Members: ' + num + ' | page ' + str(
                                i + 1) + '/' + pgs
                            embed = discord.Embed(title='',
                                                  description=desc[i],
                                                  color=1234123)
                            embed.set_author(
                                name='Ex Aspera Ad Astra Roster: ' + type,
                                icon_url=CLANICONWHT)
                            embed.set_footer(text=txt, icon_url=CLANICONWHT)
                            msg = await self.bot.edit_message(msg, embed=embed)
                            await self.bot.clear_reactions(msg)

                            # Add reactions
                            if i != 0:
                                r.append(self.prev)
                                await self.bot.add_reaction(msg, self.prev)
                            await self.bot.add_reaction(msg, self.stop)
                            await self.bot.add_reaction(msg, self.next)
                            r.append(self.next)

                        # Un-approved emoji reaction
                        # or user other than memb & EAAA
                        else:
                            if res.user != self.eaaa and res.user != self.eaaat:
                                await self.bot.remove_reaction(
                                    msg, res.reaction.emoji, res.user)

                        # get next reaction based on current page.
                        if i == 0:
                            res = await self.bot.wait_for_reaction(message=msg,
                                                                   timeout=60)

                        elif i == len(desc) - 1:
                            res = await self.bot.wait_for_reaction(message=msg,
                                                                   timeout=60)

                        else:
                            res = await self.bot.wait_for_reaction(message=msg,
                                                                   timeout=60)

                        # Timeout
                        if res is None:
                            desc[
                                0] = '**:warning: SESSION TIMED OUT:warning: **\n'
                            desc[
                                0] += 'Please try again, use "' + self.stop + '" when finished.'
                            break
                except:
                    desc[0] = '**:warning: SESSION TIMED OUT:warning: **\n'
                    desc[
                        0] += 'Please try again, use "' + self.stop + '" when finished.'

                # wrap up pagination, clear all reactions to indicate end.
                # add end to footer and new desc/or first page
                await self.bot.clear_reactions(msg)
                embed = discord.Embed(title='',
                                      description=desc[0],
                                      color=1234123)
                embed.set_author(name='Ex Aspera Ad Astra Roster: ' + type,
                                 icon_url=CLANICONWHT)
                embed.set_footer(text='Total Members: ' + num +
                                 ' | Session End',
                                 icon_url=CLANICONWHT)
                msg = await self.bot.edit_message(msg, embed=embed)
                return

            # handle invalid commands
            else:
                err = ' command contained invalid argument <' + type + '>. Please try again.'
                await self.bot.say(':x: ' + memb.mention + err)
                return

        # UPDATE ~~~~~~~
        # updates member status/role in roster. Works with
        # mention or string obj. See Update_Member in functions.py
        elif args[0] == 'update':
            if len(args) > 1:
                # permission level 3 "Admin" minimum requirement
                if perms.check(ctx.message.author, self.lvl):

                    if len(ctx.message.mentions) > 0:
                        success, badArg = f.Update_Member(
                            ctx.message.mentions[0], args[1])

                    elif args[1].lower() == 'all':
                        s = ctx.message.author.mention + 'heres a backup incase something goes wrong!'
                        await self.bot.send_file(self.bot.get_channel(
                            CHANNELS['ADMINCHATCHNL']),
                                                 'utils/roster.csv',
                                                 content=s)
                        success, badArg = f.Update_All(
                            self.bot.get_all_members(), args[1])
                        if not success:
                            err = ':x: command was at least partially '
                            err += 'unsuccessful. **See list below:**\n'
                            for i in badArg:
                                err += i + ', '
                            await self.bot.say(err)
                            return

                    else:
                        memb = f.Member_Obj(self.bot.get_all_members(),
                                            f.Build_User(args[1::]))
                        success, badArg = f.Update_Member(memb, args[1])

                    if not success:
                        await self.bot.say(':x: '+ ctx.message.author.mention+\
                        ' Cannot find user in roster.')
                        return
                else:
                    await self.bot.say(':x: '+ ctx.message.author.mention+\
                            ' You do not have permission to execute this command!')
                    return
            else:
                await self.bot.say(':x: '+ ctx.message.author.mention+\
                                   ' Command requires username or user object argument.')
                return

        # REMOVE ~~~~~~~
        # removes member from clan roster, requires username
        # string. See Remove_From_Roster in functions.py
        elif args[0] == 'remove':
            if len(args) > 1:
                # permission level 3 "Admin" minimum requirement
                if perms.check(ctx.message.author, self.lvl):
                    if len(ctx.message.mentions) > 0:
                        success, badArg = f.Remove_From_Roster(
                            ctx.message.mentions[0].name)
                    else:
                        if len(args) > 2:
                            success, badArg = f.Remove_From_Roster(
                                f.Build_User(args[1::]))
                        else:
                            success, badArg = f.Remove_From_Roster(args[1])
                else:
                    await self.bot.say(':x: '+ ctx.message.author.mention+\
                            ' You do not have permission to execute this command!')
                    return
            else:
                await self.bot.say(':x: '+ ctx.message.author.mention+\
                          ' Command requires username or user object argument.')
                return

        # MEMBER LOOKUP ~~~~~~~
        # Get information about a specific user
        elif len(ctx.message.mentions) != 0\
                 or f.Member_Obj(self.bot.get_all_members(), args[0]) != None:

            if len(args) != 1 or len(ctx.message.mentions) > 1:
                err = ctx.message.author.mention + ', to look up a members information '
                err += ' you must input a single user mention as the argument.'
                await self.bot.say(err)
                return

            if len(ctx.message.mentions) > 0:
                user, desc = f.Roster_User_info(ctx.message.mentions[0])
            else:
                user, desc = f.Roster_User_info(
                    f.Member_Obj(self.bot.get_all_members(), args[0]))

            if desc != '':
                embed = discord.Embed(title='',
                                      description=desc,
                                      color=0xD6D6D6)
                embed.set_author(name=user, icon_url=DESTICON)
                embed.set_image(url=CLANLOGOBLK)
                embed.set_footer(text='Ex Aspera Ad Astra',
                                 icon_url=CLANICONWHT)
                await self.bot.send_message(ctx.message.channel, embed=embed)
                return
            else:
                await self.bot.say(':x: '+ ctx.message.author.mention+\
                        'The user '+user.mention+\
                        ' is on the server but has not registered with me yet.')
                return

        # Get information about a specific user, with spaces in username
        elif len(args) > 1 and f.Member_Obj(self.bot.get_all_members(),
                                            f.Build_User(args)) != None:
            user, desc = f.Roster_User_info(
                f.Member_Obj(self.bot.get_all_members(), f.Build_User(args)))
            embed = discord.Embed(title='', description=desc, color=0xD6D6D6)
            embed.set_author(name=user, icon_url=DESTICON)
            embed.set_image(url=CLANLOGOBLK)
            embed.set_footer(text='Ex Aspera Ad Astra', icon_url=CLANICONWHT)
            await self.bot.send_message(ctx.message.channel, embed=embed)
            return

        # Unrecognized roster parameter
        else:
            await self.bot.say(':x: '+ ctx.message.author.mention+\
                               ' command contained invalid argument <'+\
                               args[0]+'>. Please try again.')
            return

        # If changes are successful or not
        if success:
            await self.bot.say(':white_check_mark: Successfully initiated '+\
                               ctx.message.author.mention)
        else:
            await self.bot.say(':x: '+ ctx.message.author.mention+\
                               ' command contained invalid argument <'+\
                               badArg+'>. Please try again.')
Beispiel #16
0
    async def help(self, ctx, *args):
        
        if not onoff.check('help',CLNSERVERS['Ex Aspera Ad Astra']):
            return
        
        if len(args) == 0:
            ttl = 'Ex Aspera Ad Astra Bot Commands'
            desc, roster, gr, D2, other = f.Help_Gen()
            embed = discord.Embed(title=ttl, description=desc, color=0xD6D6D6)
            embed.set_author(name='EAAA | Version '+VERSION, icon_url=CLANICONWHT)
            embed.add_field(name='**roster commands**', value=roster , inline=False)
            embed.add_field(name='**guidedroles commands**', value=gr , inline=False)
            embed.add_field(name='**Destiny 2 Commands**', value=D2 , inline=False)
            embed.add_field(name='**other commands**', value=other , inline=False)
            embed.set_image(url=CLANLOGOBLK)
            embed.set_footer(text='Ex Aspera Ad Astra Bot Commands',icon_url=CLANICONWHT)
            await self.bot.send_message(ctx.message.channel, embed=embed)

        else:
            if args[0].lower() == 'roster':
                desc, r1, r2, r3, r4, r5 = f.Help_Roster()
                embed = discord.Embed(title='Roster Commands', description=desc, color=0xD6D6D6)
                embed.set_author(name='EAAA | Version '+VERSION, icon_url=CLANICONWHT)
                embed.add_field(name=':beginner:  **roster add**', value=r1 , inline=False)
                embed.add_field(name=':beginner:  **roster add gt**', value=r2 , inline=False)
                embed.add_field(name=':beginner:  **roster add gt**', value=r3 , inline=False)
                embed.add_field(name=':beginner:  **roster show**', value=r4 , inline=False)
                embed.add_field(name=':beginner:  **roster @user**', value=r5 , inline=False)
                embed.set_image(url=CLANLOGOBLK)
                embed.set_footer(text='Ex Aspera Ad Astra Bot Roster Commands',icon_url=CLANICONWHT)
                await self.bot.send_message(ctx.message.channel, embed=embed)
            
            
            if args[0].lower() == 'guidedroles':
                desc, gr1, gr2 = f.Help_Guidedroles()
                embed = discord.Embed(title='Guided Roles Commands', description=desc, color=0xD6D6D6)
                embed.set_author(name='EAAA | Version '+VERSION, icon_url=CLANICONWHT)
                embed.add_field(name=':beginner:  **guidedroles add**', value=gr1 , inline=False)
                embed.add_field(name=':beginner:  **guidedroles**', value=gr2 , inline=False)
                embed.set_image(url=CLANLOGOBLK)
                embed.set_footer(text='Ex Aspera Ad Astra Bot guidedroles Commands',icon_url=CLANICONWHT)
                await self.bot.send_message(ctx.message.channel, embed=embed)
            
            
            if args[0].lower() == 'destiny':
                desc, d1, d2, d3, d4 = f.Help_Destiny()
                embed = discord.Embed(title='Destiny 2 Commands', description=desc, color=0xD6D6D6)
                embed.set_author(name='EAAA | Version '+VERSION, icon_url=CLANICONWHT)
                embed.add_field(name=':beginner:  **guardian**', value=d1 , inline=False)
                embed.add_field(name=':beginner:  **underbelly**', value=d2 , inline=False)
                embed.add_field(name=':beginner:  **leviathan**', value=d3 , inline=False)
                embed.add_field(name=':beginner:  **guides**', value=d4 , inline=False)
                embed.set_image(url=CLANLOGOBLK)
                embed.set_footer(text='Ex Aspera Ad Astra Bot Destiny 2 Commands',icon_url=CLANICONWHT)
                await self.bot.send_message(ctx.message.channel, embed=embed)


            if args[0].lower() == 'other':
                desc, o1, o2, o3 = f.Help_Other()
                embed = discord.Embed(title='Other Commands', description=desc, color=0xD6D6D6)
                embed.set_author(name='EAAA | Version '+VERSION, icon_url=CLANICONWHT)
                embed.add_field(name=':beginner:  **congrats**', value=o1 , inline=False)
                embed.add_field(name=':beginner:  **poll**', value=o2 , inline=False)
                embed.add_field(name=':beginner:  **tally**', value=o3 , inline=False)
                embed.set_image(url=CLANLOGOBLK)
                embed.set_footer(text='Ex Aspera Ad Astra Bot Other Commands',icon_url=CLANICONWHT)
                await self.bot.send_message(ctx.message.channel, embed=embed)


            if args[0].lower() == 'admin':
                if ctx.message.channel.name == 'admin-chat' or ctx.message.channel.name == 'admin-testing'\
                    or ctx.message.channel.name == 'eaaa-bug-reporting':
                    if  perms.check(ctx.message.author, self.lvl):
                        desc, roster, radmin, announce, reg, other = f.Help_Admin()
                        embed = discord.Embed(title='Admin ONLY Commands', description=desc, color=0xD6D6D6)
                        embed.set_author(name='EAAA | Version '+VERSION, icon_url=CLANICONWHT)
                        embed.add_field(name=':beginner:  **roster commands**', value=roster , inline=False)
                        embed.add_field(name=':beginner:  **rosteradmin commands**', value=radmin , inline=False)
                        embed.add_field(name=':beginner:  **announcement commands**', value=announce , inline=False)
                        embed.add_field(name=':beginner:  **registration commands**', value=reg , inline=False)
                        embed.add_field(name=':beginner:  **administrative commands**',value=other,inline=False)
                        embed.set_image(url=CLANLOGOBLK)
                        embed.set_footer(text='Ex Aspera Ad Astra Bot Other Commands',icon_url=CLANICONWHT)
                        await self.bot.send_message(ctx.message.channel, embed=embed)
                else:
                    await self.bot.delete_message(ctx.message)