Esempio n. 1
0
 async def list(self, ctx):
     """View a list of Kamikaze's available cogs."""
     if checks.check_admin(ctx.message):
         unInstalledCogs = str([x for x in os.listdir(".\cogs") if x.endswith(".py") and x[:-3] not in (cog.lower() for cog in self.bot.cogs)]).strip('[]').replace("'","").replace(".py", "")
         installedCogs = str([x for x in self.bot.cogs]).strip('[]').replace("'","")
         title = "Kamikaze's Cog Information"
         description ="**Installed cogs:\n**" + installedCogs + "\n\n**Uninstalled cogs:**\n" + unInstalledCogs
         em = tools.createEmbed(title, description)
         await self.bot.say(embed=em)
Esempio n. 2
0
 async def add_other(self, ctx, target: str, ip: str):
     """Add someone else's IP to the list."""
     if checks.check_admin(ctx.message):
         try:
             await self.bot.delete_message(ctx.message)
             soku_ip = tools.loadPickle('soku_ip.pickle')
             if ':' not in ip:
                 ip += ':10800'
             soku_ip[target[0].upper() + target[1:].lower()] = ip
             tools.dumpPickle(soku_ip, 'soku_ip.pickle')
             await self.bot.say(
                 "Successfully added {}'s IP to the list.".format(target))
         except Exception as e:
             await self.bot.say(
                 "Unable to add {} to the IP list.".format(target))
Esempio n. 3
0
 async def _serverSetup(self, ctx):
     """Setup server specific persistence modules."""
     if checks.check_owner(ctx.message) or checks.check_admin(ctx.message):
         serverID = ctx.message.server.id
         await self.bot.delete_message(ctx.message)
         await self.bot.say("Setting up...", delete_after=12)
         try:
             #kamikaze chime
             kamikaze_chime = tools.loadPickle('kamikaze_chime.pickle')
             kamikaze_chime[serverID] = True
             tools.dumpPickle(kamikaze_chime, 'kamikaze_chime.pickle')
             await self.bot.say("**kamikaze_chime** setup success", delete_after=10)
             # END
             await self.bot.say("Setup successful", delete_after=10)
         except Exception as e:
             await self.bot.say("SETUP FAILED\n{}: {}".format(type(e).__name__, e))
Esempio n. 4
0
 async def remove_other(self, ctx, *, target: str):
     """Remove an entry from the soku IP list."""
     if checks.check_admin(ctx.message):
         try:
             soku_ip = tools.loadPickle('soku_ip.pickle')
         except Exception as e:
             await self.bot.say("{}: {}".format(type(e).__name__, e))
         try:
             soku_ip.pop(target)
             await self.bot.say(
                 "{} was removed from the list.".format(target))
             tools.dumpPickle(soku_ip, 'soku_ip.pickle')
         except KeyError:
             try:
                 # retry after applying case sensitive modifications
                 soku_ip.pop(target[0].upper() + target[1:].lower())
                 tools.dumpPickle(soku_ip, 'soku_ip.pickle')
                 await self.bot.say(
                     "{} was removed from the list.".format(target))
             except KeyError:
                 await self.bot.say(
                     "Unable to find {} in the IP list".format(target))
         except Exception as e:
             pass
Esempio n. 5
0
 async def _say(self, ctx, channel_id : str, *, msg : str):
     """Get Kamikaze to output a message. Requires Administrator permission."""
     if checks.check_owner(ctx.message) or checks.check_admin(ctx.message):
         await self.bot.send_message(discord.Object(id=str(channel_id)), msg)
         await self.bot.delete_message(ctx.message)