17 Commits
v1.9 ... v2.2

Author SHA1 Message Date
65a0e1097e Updated version to 2.2 2023-05-07 16:24:09 +02:00
3fe67e18b0 Channel will terminate when the last user quit 2023-05-07 16:23:16 +02:00
91eecb4b0b Fixed channels logic 2023-05-02 16:13:11 +02:00
740c6a1464 Updated version to 2.1 2023-05-02 16:10:32 +02:00
3ca44dcd2d Updated version to 2.0 2023-05-02 15:10:29 +02:00
301439f144 Fixed bot trigger on deafen and mute 2023-05-02 15:09:23 +02:00
3435d59d96 Merge pull request 'Update dependency requests to v2.29.0' (#3) from renovate/requests-2.x into main
Reviewed-on: #3
2023-04-26 23:49:52 +03:00
d560bce8c6 Update dependency requests to v2.29.0 2023-04-26 18:48:15 +03:00
528604b6b4 Made a few dependencies strict 2023-04-23 10:35:27 +02:00
76c7812284 Renamed Renovate config 2023-04-20 13:38:00 +02:00
8e48334cea Merge pull request 'Configure Renovate' (#1) from renovate/configure into main
Reviewed-on: #1
2023-04-20 14:37:19 +03:00
bc9cebbec6 Add renovate.json 2023-04-20 14:13:46 +03:00
a178aa2af9 Merge branch 'main' of https://git.profitroll.eu/profitroll/YusarinBot 2023-04-19 14:27:12 +02:00
fb3e291d77 Sorted imports and removed unused ones 2023-04-19 14:23:41 +02:00
75c1889477 Formatted everything with black 2023-04-19 14:21:39 +02:00
5329b4c727 Bump pycord to 2.4.1 2023-04-19 14:16:32 +02:00
0f3a6121d6 Fixed black badge link 2023-03-22 21:30:45 +01:00
7 changed files with 49 additions and 29 deletions

6
.renovaterc Normal file
View File

@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
}

View File

@@ -7,7 +7,7 @@
<a href="https://crowdin.com/project/yusarinbot"> <a href="https://crowdin.com/project/yusarinbot">
<img alt="Crowdin" src="https://badges.crowdin.net/yusarinbot/localized.svg"> <img alt="Crowdin" src="https://badges.crowdin.net/yusarinbot/localized.svg">
</a> </a>
<a href="https://git.end-play.xyz/profitroll/TelegramPoster"> <a href="https://git.end-play.xyz/profitroll/YusarinBot">
<img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"> <img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg">
</a> </a>
<a href="https://discord.com/invite/2zpzErtnNT"> <a href="https://discord.com/invite/2zpzErtnNT">

View File

@@ -9,6 +9,7 @@ from discord import (
utils, utils,
) )
from discord.ext import commands from discord.ext import commands
from discord.abc import GuildChannel
from functions import ( from functions import (
appendLog, appendLog,
@@ -32,6 +33,11 @@ class CogChannel(commands.Cog):
def __init__(self, client): def __init__(self, client):
self.client = client self.client = client
@commands.Cog.listener()
async def on_guild_channel_delete(self, channel: GuildChannel):
if isUserVoice(channel):
await removeUserVoice(channel)
@Cog.listener() @Cog.listener()
async def on_voice_state_update( async def on_voice_state_update(
self, member: Member, before: VoiceState, after: VoiceState self, member: Member, before: VoiceState, after: VoiceState
@@ -42,23 +48,17 @@ class CogChannel(commands.Cog):
vc_to = after.channel vc_to = after.channel
# If user left vc # If user left vc
if vc_to is None: if before.channel is not None and len(before.channel.members) == 0:
if isUserVoice(vc_from): if isUserVoice(vc_from):
if isVoiceOfUser(vc_from, member): if not isVoiceOfUser(vc_from, member):
await removeUserVoice(vc_from)
return
else:
if loadJson("config.json")["enable_nomic"]: if loadJson("config.json")["enable_nomic"]:
await changeNomicPerms("deny", vc_from, member) await changeNomicPerms("deny", vc_from, member)
await removeUserVoice(vc_from)
# If user joined vc # If user joined vc
else: if after.channel is not None and after.channel.id == guildConfGet(
if isUserVoice(vc_from): member.guild, "channel"
if isVoiceOfUser(vc_from, member): ):
await removeUserVoice(vc_from)
else:
if loadJson("config.json")["enable_nomic"]:
await changeNomicPerms("deny", vc_from, member)
if isUserVoice(vc_to): if isUserVoice(vc_to):
if loadJson("config.json")["enable_nomic"]: if loadJson("config.json")["enable_nomic"]:
await changeNomicPerms("allow", vc_to, member) await changeNomicPerms("allow", vc_to, member)

View File

@@ -254,7 +254,14 @@ async def removeUserVoice(vc: VoiceChannel) -> None:
remove(vc_file) remove(vc_file)
if needed_channel is None:
appendLog(
f"Removed voice channel '{needed_channel}' of user with id {str(vc_conf['ownerid'])}",
guild=vc.guild,
)
else:
await needed_channel.delete() await needed_channel.delete()
if debug: if debug:
appendLog( appendLog(
f"Removed voice channel '{needed_channel}' ({str(needed_channel.id)}) of user with id {str(vc_conf['ownerid'])}", f"Removed voice channel '{needed_channel}' ({str(needed_channel.id)}) of user with id {str(vc_conf['ownerid'])}",
@@ -267,10 +274,17 @@ async def removeUserVoice(vc: VoiceChannel) -> None:
) )
if loadJson("config.json")["enable_nomic"]: if loadJson("config.json")["enable_nomic"]:
if nomic_channel is None:
appendLog(
f"Removed nomic channel '{nomic_channel}' of channel with id {str(needed_channel.id)}",
guild=vc.guild,
)
else:
await nomic_channel.delete() await nomic_channel.delete()
if debug: if debug:
appendLog( appendLog(
f"Removed nomic channel {nomic_channel} ({str(nomic_channel.id)}) of channel with id {str(needed_channel.id)}", f"Removed nomic channel '{nomic_channel}' ({str(nomic_channel.id)}) of channel with id {str(needed_channel.id)}",
guild=vc.guild, guild=vc.guild,
) )
else: else:

View File

@@ -1,2 +1,2 @@
ujson~=5.7.0 ujson==5.7.0
py-cord[speed]~=2.4.1 py-cord[speed]==2.4.1

View File

@@ -1,2 +1,2 @@
py-cord~=2.4.1 py-cord==2.4.1
requests~=2.28.2 requests==2.29.0

View File

@@ -12,7 +12,7 @@ from os import getpid
from functions import * from functions import *
pid = getpid() pid = getpid()
version = 1.9 version = 2.2
if ( if (
loadJson("config.json")["owner"] == "SET-OWNER-ID" loadJson("config.json")["owner"] == "SET-OWNER-ID"