async def on_voice_state_update(self, member, before, after): Get = DB.Get() Set = DB.Set() if after.channel: channel = Get.options("channels")[0] category = Get.options("category")[0] if int(after.channel.id) == int(channel): cat = discord.utils.get(member.guild.categories, id=int(category)) channel2 = await member.guild.create_voice_channel( name=f"{member.name}#{member.discriminator}", category=cat) await member.move_to(channel2) await channel2.set_permissions(member, manage_channels=True) Set.privateChannels(channel2, member) elif before.channel: if str(before.channel.id) in str( Get.privateChannels(member)[0]): try: await before.channel.delete() except Exception: pass else: if before.channel: if str(before.channel.id) in str( Get.privateChannels(member)[0]): try: await before.channel.delete() except Exception: pass
async def on_message(self, message): try: if message.channel.id in DB.Get().options("channels")["reactions"]: like = self.bot.get_emoji(671667959617552386) dislike = self.bot.get_emoji(671667959386603520) await message.add_reaction(like) await message.add_reaction(dislike) except Exception: pass
async def unmutes(self, ctx, member: discord.Member): mutes = DB.Get().mute(member) mute = mutes[1] mute_role = discord.utils.get(ctx.message.guild.roles, name="Mute") if mute != 0: DB.Set().mute(member, 0) await member.remove_roles(mute_role) await ctx.send(embed=discord.Embed( description=f'**:white_check_mark: Mute by {member.mention} Successfully removed!**',)) else: await ctx.send( embed=discord.Embed(description=f'**:warning: member {member.mention} Not muted!**',))
async def unmute(self, ctx, member: discord.Member): mutes = DB.Get().mute(member) mute = mutes[1] mute_role = discord.utils.get(ctx.message.guild.roles, name="Mute") if mute != 0: DB.Set().mute(member, 0) await member.remove_roles(mute_role) await ctx.send(embed=discord.Embed( description= f'**:white_check_mark: Мьют у пользователя {member.mention} Успешно снят! **', color=config.COLOR_GOOD)) else: await ctx.send(embed=discord.Embed( description= f'**:warning: Пользователь {member.mention} Не замьючен!**', color=config.COLOR_GOOD))
async def warns(self, ctx, member: discord.Member = None): if not member: member = ctx.author a = [] for i in DB.Get().warns(member): a.append( f"`ID - {i[0]}` | Модератор - {ctx.guild.get_member(int(i[2]))} | Причина - {i[3]}\n" ) if not a: a = ["Юзер не имеет варнов"] embed = discord.Embed(title=f"Варны {member.display_name}", description="".join(a), color=config.COLOR_GOOD) embed.set_footer(text=config.COPYRIGHT_TEXT, icon_url=config.COPYRIGHT_ICON) embed.set_thumbnail(url=ctx.author.avatar_url) await ctx.send(embed=embed)
async def mute_loop(self): try: for mem in DB.Get().mute(None): mute = mem[1] guild = self.bot.get_guild(658658120309932062) if guild: member = guild.get_member(int(mem[0])) if member: if float(mute) <= float(time.time()): DB.Set().mute(member, 0) mute_role = discord.utils.get(guild.roles, name="Muted") await member.remove_roles( mute_role, reason="Снят Мьют Временем", atomic=True) except Exception as e: print(Fore.RED + "[ERROR] " + Style.RESET_ALL + f"В цикле MUTE_LOOP произошла следующая ошибка:") print(Fore.RED + "[ERROR] " + Style.RESET_ALL + f"{e}") print(Fore.RED + "[ERROR] " + Style.RESET_ALL + f"Цикл MUTE_LOOP продолжает свою работу!")