async def send_message(client, message, args): await delete_user_message(message) if args.prison_type == 0: role = get_role_by_id(message.channel.server, "385475870770331650") elif args.prison_type == 1: role = get_role_by_id(message.channel.server, "385478966955343873") else: await client.send_message(message.channel, "Wrong number for prison_type.") return server = client.get_server("221919789017202688") user = server.get_member(args.userid) if user: await client.add_roles(user, role) await client.send_message(message.channel, f"Username: {user.name}\nTime: {args.prison_length}min" f"\nReason: {args.reason}\nBy: {message.author.name}") asyncio.ensure_future(delete_role(client, args, user, role)) try: msg_answer = await client.start_private_message(user) await client.send_message(msg_answer, content=f"Prison is now active\n Time: {args.prison_length}min\nReason: {args.reason}") except: pass else: client.send_message(message.channel, "User not found.")
async def eng(client, message, args): group_id_german = settings['group']['ger'] group_id_english = settings['group']['eng'] group_ger = get_role_by_id(message.channel.server, group_id_german) group_eng = get_role_by_id(message.channel.server, group_id_english) await client.add_roles(message.author, group_eng) await asyncio.sleep(5) await client.remove_roles(message.author, group_ger) await private_msg(message, "Thanks for telling me that!") await delete_user_message(message)
async def role_handler(member, emoji, add=True): guild_role = get_role_by_id(member.guild, role_dict[emotes[emoji]]) await member.add_roles(guild_role) if add else await member.remove_roles( guild_role) await private_msg(None, content=f"{'Added' if add else 'Removed'} {emoji}", user=member)
async def add_role(member, input_role): guild_role = get_role_by_id(member.guild, role_dict[roles[input_role]]) await member.add_roles(guild_role) await private_msg_user(None, "Thanks for telling me that!", user=member, retry_local=False)
async def add_role(client, message, input_group): ger_eng = [settings["group"]["ger"], settings["group"]["eng"]] for x in message.author.roles: if x.id in ger_eng: group_id = settings['group'][input_group] group = get_role_by_id(message.channel.server, group_id) await client.add_roles(message.author, group) await private_msg(message, "Thanks for telling me that!")
async def vs(client, message, args): group_id = settings['group']['vs'] expert_id = settings['group']['vs-expert'] group = get_role_by_id(message.channel.server, group_id) expert = get_role_by_id(message.channel.server, expert_id) if args.expert: if not has_role(message.author, expert_id): await private_msg(message.author, "You need to be an expert to do that.") elif args.remove: for mention in message.mentions: await client.remove_roles(mention, expert) await private_msg(mention, "You are no longer an VS expert.") else: for mention in message.mentions: await client.add_roles(mention, expert) await private_msg(mention, "Welcome to the VS experts!") else: if args.remove: await client.remove_roles(message.author, group) else: await client.add_roles(message.author, group)
async def remove_role(client, message, input_group): role_to_remove = get_role_by_id(message.channel.server, settings['group'][input_group]) await client.remove_roles(message.author, role_to_remove) await private_msg(message, "Role removed.")
async def remove_role(member, input_role): guild_role = get_role_by_id(member.guild, role_dict[roles[input_role]]) await member.remove_roles(guild_role) await private_msg_user(None, "Role removed.", user=member)