Exemple #1
0
async def unsilence_users():
    try:
        await asyncio.sleep(10)
        asyncio.get_event_loop().create_task(unsilence_users())
        for s in db.get_silenced():
            if s.expiration is None:
                continue
            elif datetime.datetime.now() >= s.expiration:
                for guild in client.guilds:
                    if guild.id == s.server_id:
                        muzzled = discord.utils.get(guild.roles,
                                                    name=settings.muzzled_role)
                        for member in guild.members:
                            if member.id == int(s.user_id):
                                await member.remove_roles(muzzled)
                                break
                db.unsilence(s.user_id)
    except Exception as ex:
        logger.exception(ex)
Exemple #2
0
async def unmute(ctx):
	message = ctx.message
	if is_admin(message.author):
		if len(message.mentions) > 0:
			muzzled = discord.utils.get(message.guild.roles,name=settings.muzzled_role)
			for member in message.mentions:
				await member.remove_roles(muzzled)
				if not db.unsilence(member.id):
					await post_response(message, '<@{0}> is not muzzled', member.id)
					continue
				await post_response(message, '<@{0}> has been unmuzzled', member.id)