async def on_message(message): msg = message.content mentionprefix = "<@!" + str(client.user.id) + ">" if data['init_stage'] is 0: if message.author.permissions_in(message.channel).administrator \ and message.content == "<@!" + str(client.user.id) + "> init": data['init_stage'] = 1 data['admin_channel'] = message.channel.id data['mod_channel'] = "" data['log_channel'] = "" data['user_channels'] = [] data['generic_bot_channels'] = [] save_data() elif msg.startswith(mentionprefix): msg = _strip_start(msg, mentionprefix).strip() if message.channel.id in data['user_channels']: await guildapply.invoke(message) elif message.channel.id == data['admin_channel']: await admincommands.resolve(message) elif message.channel.id in data['generic_bot_channels']: await botcommands.resolve(message) elif message.channel.id in data['user_channels']: if not message.author.permissions_in(message.channel).administrator: await message.delete()
async def remove_genericbotchannel(message, msgstack): if len(msgstack) is not 1: await error_and_delete(message) elif msgstack[0].startswith("<#") and msgstack[0].endswith(">"): channelid = _strip_start(msgstack[0], "<#") channelid = _strip_end(channelid, ">") channelid = int(channelid) print(channelid) if channelid in data['generic_bot_channels']: data['generic_bot_channels'].remove(channelid) save_data() await success_and_delete(message) else: await error_and_delete(message) else: await error_and_delete(message)
async def set_logchannel(message, msgstack): if len(msgstack) is not 1: await error_and_delete(message) elif msgstack[0].startswith("<#") and msgstack[0].endswith(">"): channelid = _strip_start(msgstack[0], "<#") channelid = _strip_end(channelid, ">") channelid = int(channelid) print(channelid) if client.guilds[0].get_channel(channelid) is not None: data['log_channel'] = channelid save_data() await success_and_delete(message) else: await error_and_delete(message) else: await error_and_delete(message)
async def add_genericbotchannel(message, msgstack): if len(msgstack) is not 1: await error_and_delete(message) elif msgstack[0].startswith("<#") and msgstack[0].endswith(">"): channelid = _strip_start(msgstack[0], "<#") channelid = _strip_end(channelid, ">") channelid = int(channelid) print(channelid) if client.guilds[0].get_channel(channelid) is not None and \ channelid not in data['generic_bot_channels']: data['generic_bot_channels'].append(channelid) save_data() await success_and_delete(message) else: await error_and_delete(message) else: await error_and_delete(message)