Compare commits

...

2 Commits

Author SHA1 Message Date
Profitroll 9d7a13f473 Fixed not working config 2023-05-06 18:31:23 +02:00
Profitroll f9a8d6ddf6 Fixed unexpected behavior 2023-05-06 18:31:07 +02:00
2 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,5 @@
from discord import ApplicationContext, Embed, option
from discord.abc import GuildChannel
from discord import utils as ds_utils
from discord.commands import SlashCommandGroup
from discord.ext import commands
@ -7,12 +8,18 @@ from classes.holo_user import HoloUser
from enums.colors import Color
from modules.utils import config_get
from modules.utils_sync import config_get_sync, guild_name
from modules.database import col_users
class CustomChannels(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_guild_channel_delete(self, channel: GuildChannel):
col_users.find_one_and_update({"customchannel": channel.id}, {"$set": {"customchannel": None}})
customchannel = SlashCommandGroup("customchannel", "Керування особистим каналом")
@customchannel.command(

View File

@ -30,7 +30,7 @@ class Logger(commands.Cog):
@commands.Cog.listener()
async def on_member_join(self, member: Member):
welcome_chan = ds_utils.get(self.client.get_guild(await config_get("guild")).channels, id=await config_get("logging", "channels", "text"))
welcome_chan = ds_utils.get(self.client.get_guild(await config_get("guild")).channels, id=await config_get("welcome", "channels", "text"))
rules_chan = ds_utils.get(self.client.get_guild(await config_get("guild")).channels, id=await config_get("rules", "channels", "text"))
if (member != self.client.user) and (member.bot == False) and (member.system == False):
@ -38,12 +38,12 @@ class Logger(commands.Cog):
await welcome_chan.send(content=(await config_get("welcome", "messages")).format(mention=member.mention, rules=rules_chan.mention))
if col_users.find_one({"user": member.id}) is None:
col_users.insert_one(document=user)
user = {}
defaults = await config_get("user", "defaults")
user["user"] = member.id
for key in defaults:
user[key] = defaults[key]
user[key] = defaults[key]
col_users.insert_one(document=user)