async def offense_time(args, msg): if'' in args: args.remove('') if msg.author.guild_permissions.administrator: types = [ float ] if not len(args) == 0: time = args[0] try: args[0] = findTime(args[0]) if len(args) == 1: guild = msg.guild od = await read('od') mT = (await read('duration'))[guild.id] if args[0] < mT: od[guild.id] = args[0] await write('od', od) await msg.channel.send('Offense duration has been set.') log_dict = await read('al') if guild.id in log_dict: disp_name = msg.author.display_name await log( f'`{disp_name}` set the offense duration to (Seconds: `{time}`)', msg ) else: await msg.channel.send( f'Offense duration cannot be longer than mute time (Seconds: `{str(mT)}`)!' ) elif len(args) != 1: command = msg.content.lower().split(' ')[0] await msg.channel.send( f'Invalid ammount of args. Example command: `{command} 5s`' ) elif not argTest(types, args): command = msg.content.lower().split(' ')[0] await msg.channel.send( f'Invalid arg types. Example command: `{command} 5s`' ) except ValueError: await msg.channel.send( f'Invalid arg type. Arg needs to be a time. Example command: `{command} 5s`' ) else: cd = (await read("od"))[msg.guild.id] await msg.channel.send(f'Current offense duration is `{cd}`')
async def set_duration(args, msg): if '' in args: args.remove('') if msg.author.guild_permissions.administrator: types = [ float ] if not len(args) == 0: try: args[0] = findTime(args[0]) if len(args) == 1: time = args[0] guild = msg.guild fdl = await read('duration') oT = (await read('od'))[guild.id] if args[0] > oT: fdl[guild.id] = args[0] await write('duration', fdl) await msg.channel.send('Default mute duration has been set.') log_dict = await read('al') if guild.id in log_dict: disp_name = msg.author.display_name await log( f'`{disp_name}` set the default mute duration (Seconds: `{time}`)', msg ) else: await msg.channel.send( f'Mute duration cannot last less time then offense duration (Seconds: `{str(oT)}`)!' ) elif len(args) != 1: command = msg.content.lower().split(' ')[0] await msg.channel.send( f'Invalid ammount of args. Example command: `{command} 5s`' ) elif not argTest(types, args): command = msg.content.lower().split(' ')[0] await msg.channel.send( f'Invalid arg types. Example command: `{command} 5s`' ) except ValueError: await msg.channel.send( f'Invalid arg type. Arg needs to be a time. Example command: `{command} 5s`' ) else: cd = (await read("duration"))[msg.guild.id] await msg.channel.send(f'Current offense duration is `{cd}`')
async def mute_increment(args, msg): try: args.remove('') except ValueError: print('oof', args) print(args) if msg.author.guild_permissions.administrator: types = [ float ] if not len(args) == 0: try: args[0] = float(args[0]) if len(args) == 1: guild = msg.guild od = await read('mi') od[guild.id] = args[0] await write('mi', od) await msg.channel.send('Mute increment has been set.') log_dict = await read('al') if guild.id in log_dict: disp_name = msg.author.display_name await log( f'`{disp_name}` set the mute increment to `{args[0]}`', msg ) elif len(args) != 1: command = msg.content.lower().split(' ')[0] await msg.channel.send( f'Invalid ammount of args. Example command: `{command} 5`' ) elif not argTest(types, args): command = msg.content.lower().split(' ')[0] await msg.channel.send( f'Invalid arg types. Example command: `{command} 5`' ) except IndexError: command = msg.content.lower().split(' ')[0] await msg.channel.send( f'Invalid arg types. Example command: `{command} 5`' ) else: cd = (await read("mi"))[msg.guild.id] await msg.channel.send(f'The current mute increment is `{cd}`')