Compare commits
2 Commits
89bb57b2fc
...
9d7a13f473
Author | SHA1 | Date | |
---|---|---|---|
9d7a13f473 | |||
f9a8d6ddf6 |
|
@ -1,4 +1,5 @@
|
||||||
from discord import ApplicationContext, Embed, option
|
from discord import ApplicationContext, Embed, option
|
||||||
|
from discord.abc import GuildChannel
|
||||||
from discord import utils as ds_utils
|
from discord import utils as ds_utils
|
||||||
from discord.commands import SlashCommandGroup
|
from discord.commands import SlashCommandGroup
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
@ -7,12 +8,18 @@ from classes.holo_user import HoloUser
|
||||||
from enums.colors import Color
|
from enums.colors import Color
|
||||||
from modules.utils import config_get
|
from modules.utils import config_get
|
||||||
from modules.utils_sync import config_get_sync, guild_name
|
from modules.utils_sync import config_get_sync, guild_name
|
||||||
|
from modules.database import col_users
|
||||||
|
|
||||||
|
|
||||||
class CustomChannels(commands.Cog):
|
class CustomChannels(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):
|
||||||
|
col_users.find_one_and_update({"customchannel": channel.id}, {"$set": {"customchannel": None}})
|
||||||
|
|
||||||
|
|
||||||
customchannel = SlashCommandGroup("customchannel", "Керування особистим каналом")
|
customchannel = SlashCommandGroup("customchannel", "Керування особистим каналом")
|
||||||
|
|
||||||
@customchannel.command(
|
@customchannel.command(
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Logger(commands.Cog):
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_member_join(self, member: Member):
|
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"))
|
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):
|
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))
|
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:
|
if col_users.find_one({"user": member.id}) is None:
|
||||||
col_users.insert_one(document=user)
|
|
||||||
|
|
||||||
user = {}
|
user = {}
|
||||||
defaults = await config_get("user", "defaults")
|
defaults = await config_get("user", "defaults")
|
||||||
|
|
||||||
user["user"] = member.id
|
user["user"] = member.id
|
||||||
|
|
||||||
for key in defaults:
|
for key in defaults:
|
||||||
user[key] = defaults[key]
|
user[key] = defaults[key]
|
||||||
|
|
||||||
|
col_users.insert_one(document=user)
|
Loading…
Reference in New Issue
Block a user