Пример #1
0
 async def edit(self, ctx):
     """Edit the countdown target."""
     AUTO_TIMEOUT = 300 # 5 minutes
     if checks.check_moderator(ctx.message):
         info1 = await self.bot.say("Please enter a new target date in format: **DD-MM-YYYY, HH:MM:SS**")
         msg1 = await self.bot.wait_for_message(timeout=AUTO_TIMEOUT, author=ctx.message.author)
         if msg1 is None:
             await tools.inputTimeout(self.bot, ctx, topic="countdown edit")
             return
         else:
             try:
                 newTime = datetime.strptime(msg1.content, '%d-%m-%Y, %H:%M:%S')
             except ValueError:
                 await self.bot.say("Sorry, formatting was incorrect. Remember to include 0s where needed. Try _!k.countdown edit_ again.")
                 return
         info2 = await self.bot.say("Please enter the countdown timer's flavour text:")
         msg2 = await self.bot.wait_for_message(timeout=AUTO_TIMEOUT, author=ctx.message.author)
         if msg2 is None:
             await tools.inputTimeout(self.bot, ctx, topic="countdown edit")
             return
         else:
             text = msg2.content
             countdown_all = tools.loadPickle('countdown_all.pickle')
             countdown_all[ctx.message.server.id] = [newTime, text]
             tools.dumpPickle(countdown_all, 'countdown_all.pickle')
             await self.bot.delete_messages([info1, msg1, info2, msg2])
             await self.bot.say("Successfully updated the server countdown target!")
     else:
         await self.bot.say("You do not have permission to do that.")
         return
Пример #2
0
    async def on_message(self, message):
        if message.author == self.bot.user or message.author.bot:
            return
        else:
            if 'marry me kamikaze' == message.content.lower():
                if checks.check_owner(message): #if you're mintea:
                    response = random.choice(['F**k off.', 'Shut up you bastard.', 'Kill yourself.', "Why don't you go jerk off to Asanagi, you Kuso."])
                else: #otherwise, if you're not mintea:
                    if random.randint(1, 10000) == 1: #roll 0.01% chance for happy end
                        await self.bot.send_message(message.channel, random.choice('Sure~ <3', 'Ok ///w///'))
                    else: #otherwise, get a response from the accumulated rejection list
                        response_choices = ['No thanks~', 'Eh? uh.. sorry.', 'Marriage? Eh.. sorry.', 'M-Marriage? Uh.. maybe not.',
                            'Marriage? Don\'t you have more important duties to attend to?', 'Maybe when you\'re a little older...',
                            'The age gap though... Sorry.']
                        if message.author.id == '172704013911982080': #if you're Jimmy:
                            more_choices = ['But you have Kawakaze...', 'But you\'re already married to Kongou...', 'If you had a girlfriend, you wouldn\'t need to constantly propose to me.', 'If you had a girlfriend, I wouldn\'t have to constantly reject you.']
                        elif message.author.id == '176610457992429568': #if you're nyanko:
                            more_choices = ['But you have Bep...']
                        try:
                            for x in more_choices:
                                response_choices.append(x)
                        except Exception:
                            pass
                        response = random.choice(response_choices)
                await self.bot.send_message(message.channel, response)

            elif 'shut up kamikaze' in message.content.lower():
                switch = tools.loadPickle('kamikaze_chime.pickle')
                switch[message.server.id] = False
                tools.dumpPickle(switch, 'kamikaze_chime.pickle')
                await self.bot.send_message(message.channel, 'Sorry... ; A ;')

            elif 'sorry kamikaze' in message.content.lower():
                switch = tools.loadPickle('kamikaze_chime.pickle')
                switch[message.server.id] = True
                tools.dumpPickle(switch, 'kamikaze_chime.pickle')
                await self.bot.send_message(message.channel, 'u w u')

            elif 'kamikaze' in message.content.lower():
                switch = tools.loadPickle('kamikaze_chime.pickle')
                try:
                    if switch[message.server.id]:
                        interruption = ['Did someone call me? :D', 'Someone say my name?']
                        await self.bot.send_message(message.channel, random.choice(interruption))
                        msg = await self.bot.wait_for_message(timeout=5, author=message.author, check=lambda x: x.content.lower() in ['yes', 'no', 'help'])
                        try:
                            if 'yes' in msg.content.lower():
                                await self.bot.send_message(message.channel, 'o w o')
                            elif 'no' in msg.content.lower():
                                await self.bot.send_message(message.channel, '> _ <')
                            elif 'help' in msg.content.lower():
                                await self.bot.send_message(message.channel, "Say !k.help for a list of commands = w =")
                        except AttributeError:
                            pass
                except KeyError:
                    await self.bot.send_message(message.channel, "No server info detected. Please run _serverSetup command.")
                except AttributeError:
                    pass
Пример #3
0
 async def remove(self, ctx):
     """Remove your IP from the soku IP list."""
     try:
         soku_ip = tools.loadPickle('soku_ip.pickle')
         soku_ip.pop(ctx.message.author.name)
         tools.dumpPickle(soku_ip, 'soku_ip.pickle')
         await self.bot.say("Successfully removed {} from the list".format(
             ctx.message.author.name))
     except KeyError:
         await self.bot.say("You are not in the soku IP list.")
     except Exception as e:
         await self.bot.say("{}: {}".format(type(e).__name__, e))
Пример #4
0
 async def add(self, ctx, ip: str):
     """Add yourself to the soku IP list."""
     await self.bot.delete_message(ctx.message)
     soku_ip = tools.loadPickle('soku_ip.pickle')
     soku_ip[ctx.message.author.name] = ip
     if ':' not in ip:
         ip += ':10800'
     try:
         tools.dumpPickle(soku_ip, 'soku_ip.pickle')
         await self.bot.say("Successfully added {} to the IP list.".format(
             ctx.message.author.name))
     except Exception as e:
         await self.bot.say('Unable to add to IP list')
Пример #5
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))
Пример #6
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))
Пример #7
0
    async def countdown(self, ctx):
        """Displays the remaining time until a specified event."""
        # Check if the server is already in the list, if not, add a dummy datetime
        countdown_all = tools.loadPickle('countdown_all.pickle')
        try:
            countdown_server = countdown_all[ctx.message.server.id]
        except KeyError:
            countdown_all[ctx.message.server.id] = [datetime.now(), "remain"]
            tools.dumpPickle(countdown_all, 'countdown_all.pickle')
            countdown_server = countdown_all[ctx.message.server.id]

        if ctx.invoked_subcommand is None:
            if countdown_server[0] > datetime.now():
                tdelta = countdown_server[0] - datetime.now()
                text = countdown_server[1]
            else:
                tdelta = datetime(year=2100, month=10, day=10, hour=10, minute=10, second=10) - datetime.now()
                text = "until nothing happens..."
            #await self.bot.say("`{}` {}".format(removeMicroseconds(tdelta), text))
            #await self.bot.say(embed=tools.createEmbed(title="{} {}".format(removeMicroseconds(tdelta), text)))
            await self.bot.say(embed=tools.createEmbed(title=str(removeMicroseconds(tdelta)), description=text))
Пример #8
0
 async def notepad(self, ctx, *, content : str=None):
     """Store some text for later viewing. Clear with '!k.notepad clear.'"""
     data = tools.loadPickle('notepad.pickle')
     author = ctx.message.author
     if content is None:
         try:
             title = "{}'s Notepad".format(author.name)
             description = ''
             for x in data[author.id]:
                 description += "{}\n".format(x)
             em = discord.Embed(title=title, description=description, colour=author.colour)
             await self.bot.say(embed=em)
         except KeyError:
             await self.bot.say("You haven't written anything in your notepad... ( ̄~ ̄;)")
     elif content == 'clear':
         data[author.id] = []
         tools.dumpPickle(data, 'notepad.pickle')
         await self.bot.say('Your notepad has been cleared~ ( ^ _ ^ )')
     else:
         try:
             data[author.id].append(content)
             tools.dumpPickle(data, 'notepad.pickle')
             await self.bot.say("Successfully saved to your notepad! \( ̄▽ ̄)/")
         except KeyError: # when it is first time data appending:
             await self.bot.say('Setting up your notepad for the first time~ ( ´ ▽ ` )')
             data[author.id] = []
             data[author.id].append(content)
             tools.dumpPickle(data, 'notepad.pickle')
             await self.bot.say("Successfully saved to your notepad! \( ̄▽ ̄)/")
Пример #9
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