async def stylish_say(self, ctx, channel_id : str, *, msg : str): """Get Kamikaze to type and send a message to a channel using embeds.""" if checks.check_owner(ctx.message): await self.bot.delete_message(ctx.message) await self.bot.send_typing(self.bot.get_channel(channel_id)) await asyncio.sleep(len(msg) / 7) await self.bot.send_message(self.bot.get_channel(channel_id), embed=tools.createEmbed(title=msg))
async def _type(self, ctx, channel_id : str, *, msg : str): """Get Kamikaze to type and send a message to a channel.""" if checks.check_owner(ctx.message): await self.bot.delete_message(ctx.message) await self.bot.send_typing(self.bot.get_channel(channel_id)) await asyncio.sleep(len(msg) / 7) await self.bot.send_message(self.bot.get_channel(channel_id), msg)
async def status(self, ctx, *, new_status : str): """Change Kamikaze's status message.""" if checks.check_owner(ctx.message): kamikaze_status = [] kamikaze_status.append(new_status) await self.bot.change_presence(game=discord.Game(name=kamikaze_status[0])) with open('kamikaze_status.pickle', 'wb') as f: pickle.dump(kamikaze_status, f)
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
async def unload(self, ctx, cog: str): """Unloads an extension""" if checks.check_owner(ctx.message): try: self.bot.unload_extension(cog) except Exception as e: await self.bot.say('Could not unload ' + cog) await self.bot.say('{}: {}'.format(type(e).__name__, e)) else: await self.bot.say('Successfully unloaded ' + cog)
async def return_id_info(self, ctx, target_id : str): """Lookup an ID.""" if checks.check_owner(ctx.message): server = self.bot.get_server(id=target_id) if server is None: for x in self.bot.servers: if x.get_member(target_id) is not None: server = x break channel = self.bot.get_channel(id=target_id) member = server.get_member(user_id=target_id) await self.bot.say("SERVER: **{}**\nCHANNEL: **{}**\nMEMBER: **{}**".format(server, channel, member)) else: await self.bot.say("You do not have permission to use that command.")
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))
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)
async def change_profile_name(self, ctx, new_name : str): """Change Kamikaze's profile name""" if checks.check_owner(ctx.message): await self.bot.edit_profile(username=new_name)
async def close(self, ctx): """Ternminate Kamikaze.""" if checks.check_owner(ctx.message): await self.bot.say('Bye Teitoku~') await self.bot.close()
async def get_discord_version(self, ctx): """Output the discord.py version.""" if checks.check_owner(ctx.message): await self.bot.say("discord.py version: **{}**".format(discord.__version__))
async def cls(self, ctx): """Pseudo cls on std_out.""" if checks.check_owner(ctx.message): print('\n'*10)