예제 #1
0
 async def color(self, ctx, *args):
     c = await self.get_context(ctx, args)
     color = get_color(clean_args(args)[0] if clean_args(args) else '') 
     try:
         await asyncio.wait_for(c.role.edit(color=color), timeout=3.0)
     except asyncio.TimeoutError:
         return await ctx.send(c.settings.get_text('rate_limited'))
     c.room.update('color', color.value)
     return await ctx.send(c.settings.get_text('updated_field_to').format(c.settings.get_text('color'), color, c.player.display_name, c.room.activity))
예제 #2
0
 async def size(self, ctx, *args):
     c = await self.get_context(ctx, args)
     try:
         new_size = clamp(int(clean_args(args)[0]), 2, 999) if clean_args(args) else None
         if len(c.room.players) > new_size:
             return await ctx.send(c.settings.get_text('size_too_small'))
         c.room.size = new_size
         c.room.update('size', new_size)
         return await ctx.send(c.settings.get_text('updated_field_to').format(c.settings.get_text('size'), new_size, c.player.display_name, c.room.activity))
     except ValueError:
         return await ctx.send(c.settings.get_text('need_integer'))
예제 #3
0
 async def timeout(self, ctx, *args):
     c = await self.get_context(ctx, args)
     new_timeout = clean_args(args)[0] if clean_args(args) else False 
     try:
         new_timeout = min(int(new_timeout), 999)
         if (new_timeout < 0):
             raise ValueError
     except ValueError:
         new_timeout = -1
     c.room.timeout = new_timeout
     c.room.update('timeout', new_timeout)
     return await ctx.send(c.settings.get_text('updated_field_to').format(c.settings.get_text('timeout'), new_timeout, c.player.display_name, c.room.activity))
예제 #4
0
 async def nsfw(self, ctx, *args):
     c = await self.get_context(ctx, args)
     first_arg = clean_args(args)[0]
     new_nsfw = text_to_bool(first_arg) if len(first_arg) > 0 else not c.room.nsfw
     await c.channel.edit(nsfw=new_nsfw)
     c.room.update('nsfw', new_nsfw)
     return await ctx.send(c.settings.get_text('updated_field_to').format(c.settings.get_text('nsfw'), new_nsfw, c.player.display_name, c.room.activity))
예제 #5
0
 async def lock(self, ctx, *args):
     c = await self.get_context(ctx, args)
     first_arg = clean_args(args)[0]
     new_lock = text_to_bool(
         first_arg) if len(first_arg) > 0 else not c.room.lock
     c.room.update('lock', new_lock)
     return await ctx.send(
         c.settings.get_text('lock_room') if new_lock else c.settings.
         get_text('unlock_room'))
예제 #6
0
 async def description(self, ctx, *args):
     c = await self.get_context(ctx, args)
     new_description = ' '.join(clean_args(args))
     topic = "({}/{}) {}".format(len(c.room.players), c.room.size, c.room.description)
     try:
         await asyncio.wait_for(c.channel.edit(topic=topic), timeout=3.0)
     except asyncio.TimeoutError:
         return await ctx.send(c.settings.get_text('rate_limited'))
     c.room.description = new_description
     c.room.update('description', new_description)
     return await ctx.send(c.settings.get_text('updated_field_to').format(c.settings.get_text('description'), new_description, c.player.display_name, c.room.activity))
예제 #7
0
 async def activity(self, ctx, *args):
     c = await self.get_context(ctx, args)
     new_activity = ' '.join(clean_args(args))
     player_name = c.player.display_name
     if len(new_activity) < 1:
         new_activity = choice(c.settings.default_names).format(player_name)
     try:
         await asyncio.wait_for(c.channel.edit(name=new_activity), timeout=3.0)
     except asyncio.TimeoutError:
         return await ctx.send(c.settings.get_text('rate_limited'))
     await c.role.edit(name="({}) {}".format(c.settings.get_text('room'), new_activity))
     if c.voice_channel:
         await c.voice_channel.edit(name=new_activity)
     c.room.activity = new_activity
     c.room.update('activity', new_activity)
     return await ctx.send(c.settings.get_text('updated_field_to').format(c.settings.get_text('activity'), new_activity, player_name, c.room.activity))