async def on_member_join(member): if str(member.server.id) == CLNSERVERS['Ex Aspera Ad Astra: Other Games']: if not onoff.check('arrival',CLNSERVERS['Ex Aspera Ad Astra: Other Games']): return eaaa_role = Get_EAAA_Role(member) if eaaa_role == 'error': err = member.mention + ', Something went wrong with retrieving your role' await bot.send_message(bot.get_channel('407211886984298506'), err) else: await bot.replace_roles(member, Role_Obj(member.server.roles, eaaa_role)) msg = member.mention + ', **you have been given your role as it stands ' msg += 'on the main Ex Aspera Ad Astra Discord Server.\n\n WELCOME!!**' await bot.send_message(bot.get_channel('407211886984298506'), msg) return if not onoff.check('arrival',CLNSERVERS['Ex Aspera Ad Astra']): return await bot.replace_roles(member, Role_Obj(member.server.roles, 'unregistered')) rmsg = "**Welcome "+member.mention+" to the Ex Aspera Ad Astra Clan Discord!**\n" rmsg += "I am EAAA, and I am the main **bot** deployed to the " rmsg += "clan server. If you don't know what a 'bot' is, don't worry, " rmsg += "we will get there...\n\n" rmsg += "As a new member, your currently listed as **unregistered** on " rmsg += "this server, so we need to take care of that immediately, " rmsg += "as right now your access to the server is **GREATLY** reduced " rmsg += "and restricted.\n\n" rmsg1 = "To begin, type the following command in the message prompt, " rmsg1 += "then press enter: ```.registration begin```" rmsg1 += "im waiting... ... ... ...**\n.\n**Ex Aspera Ad Astra Admins**\n." msg = member.mention+ ", Welcome to the **Ex Aspera Ad Astra Clan**!\n\n" msg += "**There is an important message waiting for you in the " msg += bot.get_channel(CHANNELS['REGISTERCHNL']).mention+" channel**!\n\nIf you are new to discord, " msg += "**channels** are *\"chat rooms\"*. Simply tap/click the blue text or tap/click" msg += " on the Ex Aspera Ad Astra server icon in the left pane of" msg += " your screen, scroll to the top of the menu that pops up, and tap/click" msg += " on "+bot.get_channel(CHANNELS['REGISTERCHNL']).mention+" to navigate there." await bot.send_message(bot.get_channel(CHANNELS['GAMECHATCHNL']), msg) await bot.send_message(bot.get_channel(CHANNELS['REGISTERCHNL']),rmsg) await bot.send_message(bot.get_channel(CHANNELS['REGISTERCHNL']),rmsg1)
async def underbelly(self, ctx, *args): if not onoff.check('underbelly', CLNSERVERS['Ex Aspera Ad Astra']): return if len(args) == 0: await self.bot.say(ctx.message.author.mention + ', Must include an argument') return # Command must be done in raid channel if ctx.message.channel.name != 'raid' and ctx.message.channel.name != 'team01' and ctx.message.channel.name != 'team02' and ctx.message.channel.name != 'team03': await self.bot.say(ctx.message.author.mention +\ ', This command must be ran in '+\ self.bot.get_channel(CHANNELS['RAIDCHNL']).mention) return #Supports map and code if args[0].lower() == 'map': await self.bot.say(ctx.message.author.mention + ', Here is a map of the underbelly!') await self.bot.send_file(ctx.message.channel, 'img/underbelly_leviathan.jpg') elif args[0].lower() == 'code': await self.bot.say(ctx.message.author.mention + ', The code is `153246`') else: await self.bot.say(ctx.message.author.mention + ', Invalid argument')
async def on_member_remove(member): if str(member.server.id) != CLNSERVERS['Ex Aspera Ad Astra: Other Games']: if not onoff.check('goodbye',CLNSERVERS['Ex Aspera Ad Astra']): return ascendedmsg = (Role_Obj(member.server.roles, 'Ascended')).mention + " :warning: \n**"+member.name ascendedmsg += "** has left the clan." adminmsg = (Role_Obj(member.server.roles, 'Admin')).mention + " :warning: \n"+member.name adminmsg += " has left the clan.\nYou can remove this member from the roster " adminmsg += "with the command:\n** .roster remove "+member.name+"**." await bot.send_message(bot.get_channel(CHANNELS['ASCENDEDCHATCHNL']), ascendedmsg) await bot.send_message(bot.get_channel(CHANNELS['ADMINCHATCHNL']), adminmsg)
async def leviathan(self, ctx, *args): if not onoff.check('leviathan', CLNSERVERS['Ex Aspera Ad Astra']): return errors = '' memb = ctx.message.author rchnl = self.bot.get_channel(CHANNELS['RAIDCHNL']) # Command must be done in raid channel if ctx.message.channel.name != 'raid' and ctx.message.channel.name != 'team01' and ctx.message.channel.name != 'team02' and ctx.message.channel.name != 'team03': error = memb.mention + ', This command must be ran in ' + rchnl.mention await self.bot.say(error) return if len(args) == 0: error = memb.mention + ' You must include an argument.' await self.bot.say(error) return if args[0].lower() == 'pleasure' or args[0].lower() == 'dogs': await self.bot.say(ctx.message.author.mention + '\n**Bop\'s Strategy is below:**') await self.bot.send_file(ctx.message.channel, 'img/BopsPG.png') elif args[0].lower() == 'gauntlet': await self.bot.say(ctx.message.author.mention + '\n**Bop\'s Strategy is below:**') await self.bot.send_file(ctx.message.channel, 'img/BopsG.png') elif args[0].lower() == 'baths' or args[0].lower() == 'royal': await self.bot.say(ctx.message.author.mention + '\n**Bop\'s Strategy is below:**') await self.bot.send_file(ctx.message.channel, 'img/BopsB.png') elif args[0].lower() == 'baths' or args[0].lower() == 'calus': await self.bot.say(ctx.message.author.mention + '\n**Bop\'s Strategy is below:**') await self.bot.send_file(ctx.message.channel, 'img/BopsC.png') elif args[0].lower() == 'eow' or args[0].lower() == 'argos' or\ (args[0].lower() == 'raid' and args[0].lower() == 'lair'): await self.bot.say(ctx.message.author.mention + '\n**Bop\'s Strategy is below:**') await self.bot.send_file(ctx.message.channel, 'img/BopsEoW.png') else: error = memb.mention + ', invalid argument <' + args[0] + '>.' await self.bot.say(error) return
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)
async def congrats(self, ctx, *args): if not onoff.check('congrats', CLNSERVERS['Ex Aspera Ad Astra']): return if len(ctx.message.mentions) > 0: randnum = randint(1, 3) dstr = ctx.message.mentions[0].mention + DORIANTALK[randint(0, 7)] if randnum == 1: dstr += " - **=Pug, Bop & Slinger**" await self.bot.send_file(ctx.message.channel, 'img/bop_pug_slinger_2.gif', content=dstr) if randnum == 2: dstr += " - **Bop & Pug**" await self.bot.send_file(ctx.message.channel, 'img/pug_bop.gif', content=dstr) if randnum == 3: dstr += " - **Bop, Pug, & Slinger**" await self.bot.send_file(ctx.message.channel, 'img/bop_pug_slinger.gif', content=dstr)
async def guardian(self, ctx): if not onoff.check('guardian', CLNSERVERS['Ex Aspera Ad Astra']): return await self.bot.say('I sent you a private message <@' + str(ctx.message.author.id) + '> about setting up your Guardians profile.') msg = '**Guardian Profile initated by:** <@' + str( ctx.message.author.id) msg += '>\n\n Please answer the following questions **as described** to ' msg += 'complete your guardian profile. \n\n**Note:** you must have a url ' msg += 'for your guardian screenshot. If you do not know how to obtain such ' msg += 'url, one option is to use **OneDrive**. Just upload your screenshot ' msg += 'to OneDrive on Xbox (option is right there when viewing screenshots), ' msg += 'navigate to [OneDrive](https://onedrive.live.com/about/en-us/), sign in ' msg += 'using your xbox live credentials, select your image and click *"share"* ' msg += 'to get a public link to your image. **One more step**, input that link ' msg += 'into your browser, and select the image to go full-screen. **This is the ' msg += 'image you want!**' await self.bot.send_message(ctx.message.author, msg) await self.bot.send_message(ctx.message.author, "What is the url to your Guardian Image?") img = await self.bot.wait_for_message(timeout=30.0, author=ctx.message.author) print(img) if img is 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, "What is your guardian class, species, and power level? (send as a comma-seperated list, no spaces. For example: Warlock,Human,power" ) profile = await self.bot.wait_for_message(timeout=30.0, author=ctx.message.author) print(profile) if profile is None: await self.bot.say( '<@' + str(ctx.message.author.id) + '> you did not respond in time. Please try the command again.') return #Check that user followed the directions if len((profile.content).split()) > 1: await self.bot.send_message( ctx.message.author, '<@' + str(ctx.message.author.id) + '> Your response is invalid, as it contained spaces. Please try again, and read the directions and follow the example provided.' ) return await self.bot.send_message(ctx.message.author, "Equiped Helmet?") helmet = await self.bot.wait_for_message(timeout=30.0, author=ctx.message.author) if helmet == 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, "Equiped Gauntlets?") gauntlets = await self.bot.wait_for_message(timeout=30.0, author=ctx.message.author) if gauntlets == 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, "Equiped Chest Armor?") chest = await self.bot.wait_for_message(timeout=30.0, author=ctx.message.author) if chest == 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, "Equiped Leg Armor?") legs = await self.bot.wait_for_message(timeout=30.0, author=ctx.message.author) if legs == 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, "Equiped Class Item?") classItem = await self.bot.wait_for_message(timeout=300.0, author=ctx.message.author) if classItem == 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, "Equiped shaders? (send as comma-seperated list, no spaces. For example: shader1,shader2,shader3)?" ) shaders = await self.bot.wait_for_message(timeout=300.0, author=ctx.message.author) user = ctx.message.author.name grolesObj, groles = Get_Guided_Roles(ctx.message.author) desc, msg = Guardian_Profile(profile.content, helmet.content, gauntlets.content, chest.content, legs.content, classItem.content, shaders.content, groles, user) embed = discord.Embed(title='Guardian Profile', description=desc, color=1234123) embed.set_author(name=user, icon_url=DESTICON) embed.set_image(url=img.content) print(len(desc) + len(msg)) print(msg) await self.bot.send_message( ctx.message.author, "Below is your guardian profile for review. If all looks good, reply with **'post it'**:" ) await self.bot.send_message(ctx.message.author, msg, embed=embed) res = await self.bot.wait_for_message(timeout=120.0, author=ctx.message.author) if res.content.lower() == 'post it': await self.bot.send_message(self.bot.get_channel( CHANNELS['GUARDIANCHNL']), msg, embed=embed) else: await self.bot.send_message( ctx.message.author, "**Guardian Profile not posted**. Please try again or @Admin for help." )
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)
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)
async def guidedroles(self, ctx, arg1='', arg2='', arg3=''): if not onoff.check('guidedroles', CLNSERVERS['Ex Aspera Ad Astra']): return # make some variables for large class calls gchat = self.bot.get_channel(CHANNELS['GAMECHATCHNL']) ichat = self.bot.get_channel(CHANNELS['INFORMATIONCHNL']) roles = ctx.message.server.roles # arg1 cannot be empty if arg1 == '': await self.bot.say('Must include a valid Guided Role') return # ADD GUIDED ROLE~~~~~ if arg1.lower() == 'add': gr = '' # <--- placeholder for guided role # Command must be ran in GAME-CHAT if ctx.message.channel.name != 'game-chat': await self.bot.delete_message(ctx.message) await self.bot.say(ctx.message.author.mention +\ ', That command must be ran in '+gchat.mention) return # arg2 cannot be empty if arg2 == '': await self.bot.delete_message(ctx.message) await self.bot.say('Must include a valid Guided Role to add!') return # assign guided role string if arg2[1] == '@': try: gr = f.Role_Obj(roles, arg2).name except: # mention was not a role await self.bot.delete_message(ctx.message) await self.bot.say(':x: ' + ctx.message.author.mention +\ ', That was not a valid Guided Role') return else: gr = arg2 # role = arg2 + arg3 if arg3 != '': gr = arg2 + ' ' + arg3 # Check that guided role is valid if f.Role_Obj(roles, gr) == None: await self.bot.delete_message(ctx.message) await self.bot.say(':x: ' + ctx.message.author.mention + ' <' +\ gr + '> is not a valid Guided Role.' ) return # send user a private message gchatmsg1 = ctx.message msg = f.Add_Guided_Role(ctx.message.author, ichat, gr) await self.bot.send_message(ctx.message.author, msg) gchatmsg2 = await self.bot.say(ctx.message.author.mention + ', I sent you a private message.') # wait for user to type cancel or acknowledged while True: ans = await self.bot.wait_for_message( timeout=300, author=ctx.message.author) await self.bot.delete_message(gchatmsg2) if ans.content.lower() == 'cancel': await self.bot.delete_message(gchatmsg1) await self.bot.send_message(ctx.message.author, 'Application cancelled.') return if ans.content.lower() == 'acknowledged': await self.bot.add_roles(ctx.message.author, f.Role_Obj(roles, gr)) msg = f.Guided_Roles_Msg(ctx.message.author, roles, gr) await self.bot.send_message(gchat, msg) break else: err = ':x: Your response was not recognized.\nYou must type the word ' err += '**acknowledged** to accept the role, and **cancel** to cancel ' err += 'the promotion.\n**Please try again**, and check your spelling!:' await self.bot.send_message(ctx.message.author, err) # LOOK UP MEMBERS WITH GROLE~~~~~ else: # for mentions if arg1[1] == '@': try: arg1 = f.Role_Obj(roles, arg1).name except: # mention was not a guided role await self.bot.say('Invalid Guided Role <@'+\ str(ctx.message.author.id)+'>') return # for roles with spaces if arg2 != '': arg1 = arg1 + ' ' + arg2 valid = False members = set(self.bot.get_all_members()) for g in GUIDED_ROLES: if arg1 == g: valid = True list, grole = f.Get_Role_Members(members, arg1) memlist = '\n───────\n' for l in list: memlist += '× ' + l + '\n' embed = discord.Embed(title="**Guides**", description=memlist, color=0x000000) embed.set_thumbnail(url=CLANICONWHT) embed.set_image(url=GROLES[arg1]) await self.bot.send_message(ctx.message.channel, embed=embed) # handle invalid guided role if not valid: await self.bot.say(':x: Invalid Guided Role ' + ctx.message.author.mention)
async def registration(self, ctx, arg=''): if not onoff.check('registration', CLNSERVERS['Ex Aspera Ad Astra']): return #ERROR CHECKS ~~~~~ if not allowed(ctx.message.author, self.lvls): await self.bot.say(ctx.message.author.mention + ', you are already registered.') if arg == '': await self.bot.say(ctx.message.author.mention + ' An argument is required.') if ctx.message.channel.name != 'register': await self.bot.say(ctx.message.author.mention +\ ' This command must be ran in '+ self.bot.get_channel(CHANNELS['REGISTERCHNL']).mention) # REGISTRATION BEGIN~~~~~~ if arg.lower() == 'begin': m = f.Member_Obj(self.bot.get_all_members(), 'Charlemagne') msg, msg1, msg2 = f.Registration_Begin(ctx.message.author, 1) await self.bot.say(msg) await self.bot.say(msg1) await self.bot.say(msg2) # Bot will check roster for requirements, #and aid user with missing info success = False while not success: ans = await self.bot.wait_for_message( timeout=600, author=ctx.message.author) # a respons was never recieved by user if ans is None: warn = ctx.message.author.mention + ',\n**Your registration ' warn += 'has timed out**.\n You must restart the registration ' warn += 'procedure again with command:\n ```.registration begin```' warn += '\n**NOTE**: Until you complete registration, your ' warn += 'access on this server is **GREATLY RESTRICTED**!!' await self.bot.say(warn) return # command cancel to exit registration command if ans.content.lower() == 'cancel': await self.bot.say('Registration cancelled...') return # Continue to next step, checking previous step. if ans.content.lower() == 'continue': msg, params, success = f.Registration_Check_One( ctx.message.author) await self.bot.say(msg) # followup message when roster requirements not met if not success and len(params) != 0: msg = ctx.message.author.mention + '\n**You are missing ' msg += 'required parameters: **' for p in params: if p == 'Gamertag': msg += 'GT:<' + p + '> ' else: msg += '<' + p + '> ' prfx = ctx.message.author.mention + '\nUse the command: ' msg1 = '```css\n.roster add ' msg2 = '' # get missing parameters for each required add command for p in params: if p == 'Gamertag': msg2 += '```css\n.roster add gt <' + p + '> ' else: msg1 += '<' + p + '> ' # build message based on above results if msg1 == '```css\n.roster add ': msg1 = '' else: msg1 += '```' if msg2 != '': msg1 = prfx + msg1 + ' and ' + msg2 + '```' msg1 += 'To add the above missing parameters in regards ' msg1 += 'to you individually.\nSee the first message we sent you ' msg1 += 'above right after you typed in the command **.registration ' msg1 += 'begin** for an example of valid commands.\n' msg1 += 'Type and send the message **continue** when finished...' await self.bot.say(msg) await self.bot.say(msg1) # wait for user to correct roster input, then check again ans = await self.bot.wait_for_message( timeout=600, author=ctx.message.author) # Step 1 complete, confirm to user, move on confirm = ctx.message.author.mention +\ ':white_check_mark: **Successfully added to the roster** --- continuing... ... ...\n' await self.bot.say(confirm) msg, msg1, msg2 = f.Registration_Begin(ctx.message.author, 2) await self.bot.say(msg) # dont advance until registration with Charlemagne finished while True: # dont advance until ans is equal to >loadout while True: ans = await self.bot.wait_for_message( timeout=600, author=ctx.message.author) # a respons was never recieved by user if ans is None: warn = ctx.message.author.mention + ',\n**Your registration ' warn += 'has timed out**.\n You must restart the registration ' warn += 'procedure again with command:\n ```.registration begin```' warn += '\n**NOTE**: Until you complete registration, your ' warn += 'access on this server is **GREATLY RESTRICTED**!!' await self.bot.say(warn) return if ans.content.lower() == 'cancel': await self.bot.say('Registration cancelled...') return if ans.content == '!loadout': break # collect Charlemagne response to interpret charResp = await self.bot.wait_for_message(timeout=600, author=m) # If successful: if charResp.content == '' or ctx.message.author.name == 'test8787': await self.bot.replace_roles( ctx.message.author, f.Role_Obj(ctx.message.server.roles, 'beginner')) # update member status f.Update_Member(ctx.message.author, ctx.message.author.name) # send success message and end msg = f.Registration_Final( ctx.message.author, self.bot.get_channel(CHANNELS['FOUNDERSCHNL']), self.bot.get_channel(CHANNELS['INFORMATIONCHNL']), True) await self.bot.send_message( self.bot.get_channel(CHANNELS['GAMECHATCHNL']), msg) break # If user failed to properly register with Charlemagne else: msg = f.Registration_Final( ctx.message.author, self.bot.get_channel(CHANNELS['FOUNDERSCHNL']), self.bot.get_channel(CHANNELS['INFORMATIONCHNL']), False) await self.bot.say(msg)
async def on_message(self, message): if not onoff.check('u-events-mngr',CLNSERVERS['Ex Aspera Ad Astra']): return # UPCOMING-EVENTS MESSAGES if message.channel.name == 'upcoming-events': if message.author.name != 'Spirit': await asyncio.sleep(2.0) await self.bot.delete_message(message) if message.content != '!event': msg = ':warning: \n' + f.Role_Obj(message.server.roles, 'Admin').mention + ', ' msg += message.author.name + ' has entered an illegal message in ' msg += self.bot.get_channel(CHANNELS['UPCOMINGEVENTSCHNL']).mention await self.bot.send_message(self.bot.get_channel(CHANNELS['ADMINCHATCHNL']), msg) else: if message.content != '': await self.bot.delete_message(message) await self.bot.process_commands(message) # PRIVATE CHANNEL MESSAGES if message.channel.is_private: memb = f.Member_Obj(self.bot.get_all_members(), message.author.name) try: args = message.content.split() if args[0].lower() == 'i' and args[1].lower() == 'accept': code = f.Get_Ascended_Code(message.author) if str(code) == str(args[2]): # variables gchat = self.bot.get_channel(CHANNELS['GAMECHATCHNL']) achat = self.bot.get_channel(CHANNELS['ASCENDEDCHATCHNL']) ascendedRole = f.Role_Obj(gchat.server.roles, 'Ascended') # check that member doesnt already have role if f.Member_Is_Role(memb, ascendedRole.name): err = 'You have already Ascended '+memb.name+'?' await self.bot.send_message(memb, err) self.bot.process_commands(message) return # make changes await self.bot.add_roles(memb, ascendedRole) msg = '**Thank you, The changes have been made.**' await self.bot.send_message(memb, msg) # confirm to user, and announce gmsg = message.author.mention + ' **has** '+ascendedRole.mention+'!' amsg = message.author.mention + ' **welcome to the **'+ascendedRole.mention+'!' await self.bot.send_message(gchat, gmsg) await self.bot.send_message(achat, amsg) else: err = ':x: That code is invalid. Try again.' await self.bot.send_message(memb, err) except: err = 'Sorry2? I didnt understand that. speak with Admin if theres an issue.' await self.bot.send_message(memb, err) await self.bot.process_commands(message) i = 0 msgList = message.content.split(' ') while i < len(msgList): if msgList[i].lower() == 'get': if (i+1) < len(msgList) and msgList[i+1].lower() == 'it': if (i+2) < len(msgList): s = re.sub('[^a-zA-Z]+', '', msgList[i+2]) if s.lower() == 'done': dstr = '*Your minds must be one!*' await self.bot.send_file(message.channel, 'img/bop_church.gif',content= dstr) await self.bot.process_commands(message) break i += 1
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.')
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)