9 Commits
v1.0 ... v1.3

Author SHA1 Message Date
4362d5cac4 Update 1.3 2022-02-10 21:26:16 +02:00
Profitroll
f52f9c2281 Update 1.2 2022-02-08 23:41:40 +02:00
9e19c28b82 Update 1.2 2022-02-08 23:37:24 +02:00
604e614401 Merge branch 'main' of https://github.com/profitrollgame/YusarinBot 2022-02-07 03:18:17 +02:00
dbe9236925 Update 1.1 2022-02-07 03:18:03 +02:00
Profitroll
80a34eb3eb Update 1.1 2022-02-07 03:17:38 +02:00
199d612098 Update 1.1 2022-02-07 03:11:51 +02:00
9acefbe757 Update 1.1 2022-02-07 03:10:47 +02:00
f165a1eeb5 Update 1.1 2022-02-07 03:06:01 +02:00
9 changed files with 362 additions and 153 deletions

View File

@@ -26,12 +26,16 @@ Installation instructions are listed below. Please, make sure you have installed
12. Bot is ready! Run it using `python yusarin.py` 12. Bot is ready! Run it using `python yusarin.py`
## Config explanation ## Config explanation
- "debug" - Option that enabled more detailed log messages [Boolean]
- "owner" - Discord ID of user who will be able to execute admin commands (`$shutdown` for example) [Integer] - "owner" - Discord ID of user who will be able to execute admin commands (`$shutdown` for example) [Integer]
- "bot_name" - Name of your bot. Is not used anywhere yet [String] - "bot_name" - Name of your bot. Is not used anywhere yet [String]
- "bot_token" - Token of your Discord bot [String] - "bot_token" - Token of your Discord bot [String]
- "bot_prefix" - Default prefix for all bot commands [String] - "bot_prefix" - Default prefix for all bot commands [String]
- "bot_locale" - Default language file of bot. Name of file in `locale` folder without extension is used [String] - "bot_locale" - Default language file of bot. Name of file in `locale` folder without extension is used [String]
- "bot_activity" - The name (string) of the song bot will be listening to [String] - "bot_activity" - The name (string) of the song bot will be listening to [String]
- "check_for_updates" - Option that defines whether bot should check for a new version available [Boolean]
- "auto_clear_trash" - Option that defines whether bot should clean all buggy inactive channels every "auto_clear_timer" seconds [Boolean]
- "auto_clear_timer" - Option that defines how often "auto_clear_trash" will do its job [Integer]
## Extra ## Extra
1. Bot doesn't have any self updaters **yet** 1. Bot doesn't have any self updaters **yet**

View File

@@ -1,8 +1,12 @@
{ {
"debug": false,
"owner": SET-OWNER-ID, "owner": SET-OWNER-ID,
"bot_name": "Yusa Nishimori", "bot_name": "Yusa Nishimori",
"bot_token": "SET-BOT-TOKEN", "bot_token": "SET-BOT-TOKEN",
"bot_prefix": "$", "bot_prefix": "$",
"bot_locale": "en", "bot_locale": "en",
"bot_activity": "How-Low-Hello - Keep on Burnin'" "bot_activity": "How-Low-Hello - Keep on Burnin'",
"check_for_updates": true,
"auto_clear_trash": false,
"auto_clear_timer": 120
} }

View File

@@ -1,4 +1,9 @@
import json, os, sys, shutil, discord import os
import sys
import json
import shutil
import discord
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
@@ -6,6 +11,19 @@ path = Path(__file__).resolve().parent
log_size = 512 log_size = 512
# This is the default option for "debug" key in
# file config.json, so if cebug is not set in it
# bot will use this value instead.
debug = False
try:
with open("config.json", 'r', encoding="utf-8") as json_file:
output = json.load(json_file)
json_file.close()
debug = output["debug"]
except:
debug = debug
# Check latest log size # Check latest log size
def checkSize(): def checkSize():
global path global path
@@ -29,12 +47,20 @@ def checkSize():
pass pass
# Append string to log # Append string to log
def appendLog(message, guild="none"): def appendLog(message, guild=None, announce=True):
global debug
global path global path
message_formatted = f'[{datetime.now().strftime("%d.%m.%Y")}] [{datetime.now().strftime("%H:%M:%S")}] [{str(guild)}] {message}' if guild == None:
message_formatted = f'[{datetime.now().strftime("%d.%m.%Y")}] [{datetime.now().strftime("%H:%M:%S")}] {message}'
else:
if debug:
message_formatted = f'[{datetime.now().strftime("%d.%m.%Y")}] [{datetime.now().strftime("%H:%M:%S")}] [{guild} | {str(guild.id)}] {message}'
else:
message_formatted = f'[{datetime.now().strftime("%d.%m.%Y")}] [{datetime.now().strftime("%H:%M:%S")}] [{guild}] {message}'
print(message_formatted) if announce:
print(message_formatted)
checkSize() checkSize()
@@ -48,54 +74,87 @@ def saveJson(value, filename):
f.close() f.close()
def loadJson(filename): def loadJson(filename):
global debug
try: try:
with open(filename, 'r', encoding="utf-8") as json_file: with open(filename, 'r', encoding="utf-8") as json_file:
output = json.load(json_file) output = json.load(json_file)
json_file.close() json_file.close()
except Exception as exp: except Exception as exp:
appendLog(f"Could not get contents of json file {filename} due to exception {exp}") if debug:
appendLog(f"Could not load json file {filename} due to exception {exp}")
output = {} output = {}
return output return output
def getMsg(string): def gotCommand(message):
global path global debug
config = loadJson("config.json") if debug:
try: appendLog(f"Command '{message.content}' from {message.author} ({str(message.author.id)})", message.guild)
locale = loadJson(f'{path}/locale/{config["bot_locale"]}.json') else:
return locale["messages"][string] appendLog(f"Command '{message.content}' from {message.author}", message.guild)
except Exception as exp:
appendLog(f"Could not get locale string named {string} due to exception {exp}")
return f"Could not get locale string {string}"
def guildConfGet(guild, variable): def guildConfGet(guild, variable):
global path global path
config = loadJson(f"{path}/guilds/{str(guild)}/config.json") global debug
try: try:
config = loadJson(f"{path}/guilds/{str(guild.id)}/config.json")
return config[variable] return config[variable]
except: except Exception as exp:
if debug:
appendLog(f"Could not get guild config key '{variable}' due to {exp}", guild)
return None return None
def guildConfSet(guild, variable, value): def guildConfSet(guild, variable, value):
global path global path
config = loadJson(f"{path}/guilds/{str(guild)}/config.json") config = loadJson(f"{path}/guilds/{str(guild.id)}/config.json")
config[variable] = value config[variable] = value
try: try:
saveJson(config, f"{path}/guilds/{str(guild)}/config.json") saveJson(config, f"{path}/guilds/{str(guild.id)}/config.json")
except: except:
os.mkdir(f"{path}/guilds/{str(guild)}") os.mkdir(f"{path}/guilds/{str(guild.id)}")
os.mkdir(f"{path}/guilds/{str(guild)}/channels") os.mkdir(f"{path}/guilds/{str(guild.id)}/channels")
saveJson(config, f"{path}/guilds/{str(guild)}/config.json") saveJson(config, f"{path}/guilds/{str(guild.id)}/config.json")
appendLog(f"Guild config key '{variable}' is now set to '{value}'", guild)
def guildConfReset(guild, variable): def guildConfReset(guild, variable):
global path global path
config = loadJson(f"{path}/guilds/{str(guild)}/config.json")
del config[variable]
try: try:
saveJson(config, f"{path}/guilds/{str(guild)}/config.json") config = loadJson(f"{path}/guilds/{str(guild.id)}/config.json")
del config[variable]
try:
saveJson(config, f"{path}/guilds/{str(guild.id)}/config.json")
except:
os.mkdir(f"{path}/guilds/{str(guild.id)}")
os.mkdir(f"{path}/guilds/{str(guild.id)}/channels")
saveJson(config, f"{path}/guilds/{str(guild.id)}/config.json")
appendLog(f"Guild config key '{variable}' has been reset", guild)
except Exception as exp:
appendLog(f"Could not reset guild config key '{variable}' due to {exp}", guild)
def guildLocaleGet(guild):
global path
config = loadJson(f"{path}/config.json")
try:
locale = guildConfGet(guild, "locale")
except: except:
os.mkdir(f"{path}/guilds/{str(guild)}") return config["bot_locale"]
os.mkdir(f"{path}/guilds/{str(guild)}/channels") if locale is None:
saveJson(config, f"{path}/guilds/{str(guild)}/config.json") return config["bot_locale"]
else:
return locale
def getMsg(string, guild=None):
global path
config = loadJson("config.json")
try:
locale = loadJson(f'{path}/locale/{guildLocaleGet(guild)}.json')
return locale["messages"][string]
except Exception as exp:
appendLog(f"Could not get locale string named {string} due to exception {exp}", guild)
return f"Could not get locale string {string}"
def getEmbed(string, guild=None):
# Feature coming soon
pass
def isUserVoice(vc): def isUserVoice(vc):
global path global path
@@ -110,6 +169,7 @@ def isUserVoice(vc):
async def removeUserVoice(vc): async def removeUserVoice(vc):
global path global path
global debug
channels_list = os.listdir(f"{path}/guilds/{str(vc.guild.id)}/channels/") channels_list = os.listdir(f"{path}/guilds/{str(vc.guild.id)}/channels/")
if f"{vc.id}.json" in channels_list: if f"{vc.id}.json" in channels_list:
vc_file = f"{path}/guilds/{str(vc.guild.id)}/channels/{str(vc.id)}.json" vc_file = f"{path}/guilds/{str(vc.guild.id)}/channels/{str(vc.id)}.json"
@@ -121,14 +181,21 @@ async def removeUserVoice(vc):
os.remove(vc_file) os.remove(vc_file)
await needed_channel.delete() await needed_channel.delete()
appendLog(f"Removed voice channel {str(needed_channel.id)} of user {str(vc_conf['ownerid'])}", guild=vc.guild.id) if debug:
appendLog(f"Removed voice channel '{needed_channel}' ({str(needed_channel.id)}) of user with id {str(vc_conf['ownerid'])}", guild=vc.guild)
else:
appendLog(f"Removed voice channel '{needed_channel}' of user with id {str(vc_conf['ownerid'])}", guild=vc.guild)
await nomic_channel.delete() await nomic_channel.delete()
appendLog(f"Removed nomic channel {str(nomic_channel.id)} of channel {str(needed_channel.id)}", guild=vc.guild.id) if debug:
appendLog(f"Removed nomic channel {nomic_channel} ({str(nomic_channel.id)}) of channel with id {str(needed_channel.id)}", guild=vc.guild)
else:
appendLog(f"Removed nomic channel '{nomic_channel}' of channel with id {str(needed_channel.id)}", guild=vc.guild)
else: else:
return return
async def createUserVoice(vc, category, member): async def createUserVoice(vc, category, member):
global path global path
global debug
chan = {} chan = {}
overwrites_channel = { overwrites_channel = {
vc.guild.default_role: discord.PermissionOverwrite(view_channel=True), vc.guild.default_role: discord.PermissionOverwrite(view_channel=True),
@@ -140,15 +207,21 @@ async def createUserVoice(vc, category, member):
vc.guild.me: discord.PermissionOverwrite(read_messages=True, view_channel=True, manage_channels=True), vc.guild.me: discord.PermissionOverwrite(read_messages=True, view_channel=True, manage_channels=True),
member: discord.PermissionOverwrite(read_messages=True, view_channel=True, manage_channels=True) member: discord.PermissionOverwrite(read_messages=True, view_channel=True, manage_channels=True)
} }
created_channel = await vc.guild.create_voice_channel(getMsg("name_voice").format(member.name), category=category, overwrites=overwrites_channel) created_channel = await vc.guild.create_voice_channel(getMsg("name_voice", vc.guild).format(member.name), category=category, overwrites=overwrites_channel)
appendLog(f"Created voice channel {str(created_channel.id)} for user {str(member.id)}", guild=vc.guild.id) if debug:
appendLog(f"Created voice channel '{created_channel}' ({str(created_channel.id)}) for user {member} ({str(member.id)})", guild=vc.guild)
else:
appendLog(f"Created voice channel '{created_channel}' for user {member}", guild=vc.guild)
if not os.path.isdir(f"{path}/guilds/{str(created_channel.guild.id)}/channels"): if not os.path.isdir(f"{path}/guilds/{str(created_channel.guild.id)}/channels"):
os.mkdir(f"{path}/guilds/{str(created_channel.guild.id)}/channels") os.mkdir(f"{path}/guilds/{str(created_channel.guild.id)}/channels")
vc_file = f"{path}/guilds/{str(created_channel.guild.id)}/channels/{str(created_channel.id)}.json" vc_file = f"{path}/guilds/{str(created_channel.guild.id)}/channels/{str(created_channel.id)}.json"
chan["ownerid"] = member.id chan["ownerid"] = member.id
saveJson(chan, vc_file) saveJson(chan, vc_file)
nomic_channel = await vc.guild.create_text_channel(getMsg("name_nomic").format(created_channel.id), category=category, overwrites=overwrites_nomic, topic=getMsg("description_nomic").format(str(created_channel.id))) nomic_channel = await vc.guild.create_text_channel(getMsg("name_nomic", vc.guild).format(created_channel.id), category=category, overwrites=overwrites_nomic, topic=getMsg("description_nomic", vc.guild).format(str(created_channel.id)))
appendLog(f"Created nomic channel {str(nomic_channel.id)} for channel {str(created_channel.id)}", guild=vc.guild.id) if debug:
appendLog(f"Created nomic channel '{nomic_channel}' ({str(nomic_channel.id)}) for channel '{created_channel}' ({str(created_channel.id)})", guild=vc.guild)
else:
appendLog(f"Created nomic channel '{nomic_channel}' for channel '{created_channel}'", guild=vc.guild)
chan["nomic"] = nomic_channel.id chan["nomic"] = nomic_channel.id
saveJson(chan, vc_file) saveJson(chan, vc_file)
return created_channel return created_channel
@@ -171,32 +244,58 @@ async def changeNomicPerms(mode, vc, member):
await nomic_channel.set_permissions(member, view_channel=False) await nomic_channel.set_permissions(member, view_channel=False)
else: else:
await nomic_channel.set_permissions(member, view_channel=True) await nomic_channel.set_permissions(member, view_channel=True)
async def clearTrash(client):
global path
if not os.path.isdir(f"{path}/guilds/"):
os.mkdir(f"{path}/guilds")
guilds_list = os.listdir(f"{path}/guilds/")
for guild in guilds_list:
guild_object = client.get_guild(int(guild))
if os.path.isdir(f"{path}/guilds/{guild}/channels"):
channels_list = os.listdir(f"{path}/guilds/{guild}/channels/")
for channel in channels_list:
channel_id = channel[:-5]
try:
selected_channel = discord.utils.get(guild_object.voice_channels, id=int(channel_id))
channel_owner = loadJson(f"{path}/guilds/{guild}/channels/{channel}")["ownerid"]
remove_channel = True
for member in selected_channel.members:
if member.id == channel_owner:
remove_channel = False
if remove_channel:
await removeUserVoice(selected_channel)
except:
os.remove(f"{path}/guilds/{guild}/channels/{channel_id}.json")
#async def autoClearTrash(client):
# execute clearTrash every 120 seconds
async def guildConfigured(guild): async def guildConfigured(guild):
output = {} output = {}
config = loadJson("config.json") config = loadJson("config.json")
for kind in ["channel", "category", "prefix"]: for kind in ["channel", "category", "prefix"]:
if guildConfGet(guild.id, kind) is not None: if guildConfGet(guild, kind) is not None:
try: try:
if kind == "channel": if kind == "channel":
guild_object = discord.utils.get(guild.channels, id=guildConfGet(guild.id, kind)) guild_object = discord.utils.get(guild.channels, id=guildConfGet(guild, kind))
output[kind] = getMsg("configured_"+kind).format(guild_object.name) output[kind] = getMsg("configured_"+kind, guild).format(guild_object.name)
elif kind == "category": elif kind == "category":
guild_object = discord.utils.get(guild.categories, id=guildConfGet(guild.id, kind)) guild_object = discord.utils.get(guild.categories, id=guildConfGet(guild, kind))
output[kind] = getMsg("configured_"+kind).format(guild_object.name) output[kind] = getMsg("configured_"+kind, guild).format(guild_object.name)
elif kind == "prefix": elif kind == "prefix":
output[kind] = getMsg("configured_"+kind).format(guildConfGet(guild.id, kind)) output[kind] = getMsg("info_prefix", guild).format(guildConfGet(guild, kind))
except Exception as exp: except Exception as exp:
if kind == "prefix": if kind == "prefix":
output[kind] = getMsg("unconfigured_"+kind).format(config["bot_prefix"]) output[kind] = getMsg("info_prefix", guild).format(config["bot_prefix"])
else: else:
output[kind] = getMsg("unconfigured_"+kind) output[kind] = getMsg("unconfigured_"+kind, guild)
else: else:
if kind == "prefix": if kind == "prefix":
output[kind] = getMsg("unconfigured_"+kind).format(config["bot_prefix"]) output[kind] = getMsg("info_prefix", guild).format(config["bot_prefix"])
else: else:
output[kind] = getMsg("unconfigured_"+kind) output[kind] = getMsg("unconfigured_"+kind, guild)
return getMsg("server_config").format(output["prefix"], output["channel"], output["category"]) return getMsg("server_config", guild).format(output["prefix"], getMsg("info_locale", guild).format(getMsg("locale_name", guild)), output["channel"], output["category"])

View File

@@ -1,34 +1,39 @@
{ {
"messages": { "messages": {
"shutdown": "Shutting down...", "shutdown": "Shutting down...",
"locale_set": "Bot's locale has been changed to **English**", "locale_name": "English",
"help": "**List of command:**\n{0}• Set parent channel: `{1}channel CHANNEL-ID`\n• Set parent category: `{2}category CATEGORY-ID`\n• Set commands prefix: `{3}prefix SYMBOL`\n\nTo reset channel/category/prefix use `reset` as argument\n\nPlease note that channel/category name ≠ ID of channel/category", "locale_set": "Bot's locale has been changed to `English`",
"help": "**List of command:**\n{0}• Set parent channel: `{1}channel CHANNEL-ID`\n• Set parent category: `{2}category CATEGORY-ID`\n• Set commands prefix: `{3}prefix SYMBOL`\n• Change bot's locale on server `{4}locale LOCALE`\n\nTo reset channel/category/prefix use `reset` as argument\n\nPlease note that channel/category name ≠ ID of channel/category",
"help_owner": "• Turn off the bot: `{0}shutdown`\n", "help_owner": "• Turn off the bot: `{0}shutdown`\n",
"command_in_dm": "Commands can only be executed on the server", "command_in_dm": "Commands can only be executed on the server",
"command_forbidden": "To set up private channels, you need to have **Administrator** permission on the server", "command_forbidden": "To set up private channels, you need to have **Administrator** permission on the server",
"usage_channel": "Correct usage: `{0}channel CHANNEL-ID`\nPlease note that name of channel ≠ ID of channel.\nFind out more about this here: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID", "usage_channel": "Correct usage: `{0}channel CHANNEL-ID`\nPlease note that name of channel ≠ ID of channel.\nFind out more about this here: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID",
"usage_category": "Correct usage: `{0}category CATEGORY-ID`\nPlease note that name of category ≠ ID of category.\nFind out more about it here: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID", "usage_category": "Correct usage: `{0}category CATEGORY-ID`\nPlease note that name of category ≠ ID of category.\nFind out more about it here: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID",
"usage_prefix": "Correct usage: `{0}prefix SYMBOL`", "usage_prefix": "Correct usage: `{0}prefix SYMBOL`",
"usage_locale": "Correct usage: `{0}locale LOCALE`\nAvailable locales: {1}",
"result_channel": "Voice channel **{0}** is now set as parent", "result_channel": "Voice channel **{0}** is now set as parent",
"result_category": "Category **{0}** is now set as parent", "result_category": "Category **{0}** is now set as parent",
"result_prefix": "Command prefix **{0}** is now set as primary for this server", "result_prefix": "Command prefix **{0}** is now set as primary for this server",
"warn_channel": "⚠ Parent channel is not set!\nFor the bot to work, you need to set parent channel: `{0}channel CHANNEL-ID`", "warn_channel": "⚠ Parent channel is not set!\nFor the bot to work, you need to set parent channel: `{0}channel CHANNEL-ID`",
"warn_category": "⚠ Parent category is not set!\nFor the bot to work, you need to set parent category: `{0}category CATEGORY-ID`", "warn_category": "⚠ Parent category is not set!\nFor the bot to work, you need to set parent category: `{0}category CATEGORY-ID`",
"warn_text_channel": "⚠ Selected channel is a text channel!\nPlease, use an ID of the voice channel instead.",
"reset_channel": "Parent voice channel has been reset", "reset_channel": "Parent voice channel has been reset",
"reset_category": "Parent category has been reset", "reset_category": "Parent category has been reset",
"reset_prefix": "Commands prefix has been reset and now is `{0}`", "reset_prefix": "Commands prefix has been reset and now is `{0}`",
"reset_locale": "Bot's locale on this server has been reset and now is `{0}`",
"none_channel": "Parent voice channel is not set", "none_channel": "Parent voice channel is not set",
"none_category": "Parent category is not set", "none_category": "Parent category is not set",
"none_prefix": "Commands prefix is not set, using default prefix `{0}`", "none_prefix": "Commands prefix is not set, using default prefix `{0}`",
"server_config": "**Server status:**\n{0}\n{1}\n{2}\n\n", "none_locale": "Bot's locale on this server is not set, using default locale: `{0}`",
"unconfigured_prefix": " Commands prefix: `{0}`", "server_config": "**Server status:**\n{0}\n{1}\n{2}\n{3}\n\n",
"info_prefix": " Commands prefix: `{0}`",
"info_locale": " Bot's server language: `{0}`",
"unconfigured_channel": "⚠ Parent channel", "unconfigured_channel": "⚠ Parent channel",
"unconfigured_category": "⚠ Parent category", "unconfigured_category": "⚠ Parent category",
"configured_prefix": " Commands prefix: `{0}`", "configured_channel": "☑ Parent channel: `{0}`",
"configured_channel": "☑ Parent channel: **{0}**", "configured_category": "☑ Parent category: `{0}`",
"configured_category": "☑ Parent category: **{0}**",
"name_voice": "{0}'s channel", "name_voice": "{0}'s channel",
"name_nomic": "no-mic-{0}", "name_nomic": "no-mic-{0}",
"description_nomic": "Text channel for no mic communication\nVoice room ID: {0}" "description_nomic": "Text channel for no mic communication\nVoice room ID: {0}"
} }
} }

View File

@@ -1,34 +1,39 @@
{ {
"messages": { "messages": {
"shutdown": "Выключаюсь...", "shutdown": "Выключаюсь...",
"locale_set": "Язык бота был изменён на **Русский**", "locale_name": "Русский",
"help": "**Список команд:**\n{0}• Установить родительский канал: `{1}channel ID-КАНАЛА`\n• Установить родительскую категорию: `{2}category ID-КАТЕГОРИИ`\n• Установить префикс команд: `{3}prefix СИМВОЛ`\n\nДля сброса канала/категории/префикса используйте `reset` как аргумент\n\nОбратите внимание, что имя канала/категории ≠ ID канала/категории", "locale_set": "Язык бота на сервере был изменён на `Русский`",
"help": "**Список команд:**\n{0}• Установить родительский канал: `{1}channel ID-КАНАЛА`\n• Установить родительскую категорию: `{2}category ID-КАТЕГОРИИ`\n• Установить префикс команд: `{3}prefix СИМВОЛ`\n• Сменить язык бота на сервере: `{4}locale ЯЗЫК`\n\nДля сброса канала/категории/префикса используйте `reset` как аргумент\n\nОбратите внимание, что имя канала/категории ≠ ID канала/категории",
"help_owner": "• Выключиться: `{0}shutdown`\n", "help_owner": "• Выключиться: `{0}shutdown`\n",
"command_in_dm": "Команды можно исполнять только находясь на сервере", "command_in_dm": "Команды можно исполнять только находясь на сервере",
"command_forbidden": "Для настройки приватных каналов нужно иметь право **Администратор** на сервере", "command_forbidden": "Для настройки приватных каналов нужно иметь право **Администратор** на сервере",
"usage_channel": "Правильное использование: `{0}channel ID-КАНАЛА`\nОбратите внимание, что имя канала ≠ ID канала.\nУзнайте больше об этом тут: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID", "usage_channel": "Правильное использование: `{0}channel ID-КАНАЛА`\nОбратите внимание, что имя канала ≠ ID канала.\nУзнайте больше об этом тут: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID",
"usage_category": "Правильное использование: `{0}category ID-КАТЕГОРИИ`\nОбратите внимание, что имя категории ≠ ID категории.\nУзнайте больше об этом тут: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID", "usage_category": "Правильное использование: `{0}category ID-КАТЕГОРИИ`\nОбратите внимание, что имя категории ≠ ID категории.\nУзнайте больше об этом тут: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID",
"usage_prefix": "Правильное использование: `{0}prefix СИМВОЛ`", "usage_prefix": "Правильное использование: `{0}prefix СИМВОЛ`",
"result_channel": "Голосовой канал **{0}** был установлен как родительский", "usage_locale": "Правильное использование: `{0}locale ЯЗЫК`\nДоступные языки: {1}",
"result_category": "Категория **{0}** была установлена как родительская", "result_channel": "Голосовой канал `{0}` был установлен как родительский",
"result_prefix": "Префикс **{0}** был установлен как основной для этого сервера", "result_category": "Категория `{0}` была установлена как родительская",
"result_prefix": "Префикс `{0}` был установлен как основной для этого сервера",
"warn_channel": "⚠ Родительский канал не установлен!\nДля работы бота нужно установить канал: `{0}channel ID-КАНАЛА`", "warn_channel": "⚠ Родительский канал не установлен!\nДля работы бота нужно установить канал: `{0}channel ID-КАНАЛА`",
"warn_category": "⚠ Родительская категория не установлена!\nДля работы бота нужно установить категорию: `{0}category ID-КАТЕГОРИИ`", "warn_category": "⚠ Родительская категория не установлена!\nДля работы бота нужно установить категорию: `{0}category ID-КАТЕГОРИИ`",
"warn_text_channel": "⚠ Выбранный канал является текстовым!\nПожалуйста, укажите ID голосового канала.",
"reset_channel": "Родительский голосовой канал был сброшен", "reset_channel": "Родительский голосовой канал был сброшен",
"reset_category": "Родительская категория была сброшена", "reset_category": "Родительская категория была сброшена",
"reset_prefix": "Прификс команд был сброшен, теперь это `{0}`", "reset_prefix": "Прификс команд был сброшен, теперь это `{0}`",
"reset_locale": "Язык бота на этом сервере был сброшен, теперь это `{0}`",
"none_channel": "Родительский голосовой канал не был задан", "none_channel": "Родительский голосовой канал не был задан",
"none_category": "Родительская категория не была задана", "none_category": "Родительская категория не была задана",
"none_prefix": "Префикс команд не был задан, используется стандартный `{0}`", "none_prefix": "Префикс команд не был задан, используется стандартный `{0}`",
"server_config": "**Статус сервера:**\n{0}\n{1}\n{2}\n\n", "none_locale": "Язык бота на сервере не был задан, используется стандартный: `{0}`",
"unconfigured_prefix": " Префикс команд: `{0}`", "server_config": "**Статус сервера:**\n{0}\n{1}\n{2}\n{3}\n\n",
"info_prefix": " Префикс команд: `{0}`",
"info_locale": " Язык бота на сервере: `{0}`",
"unconfigured_channel": "⚠ Родительский канал", "unconfigured_channel": "⚠ Родительский канал",
"unconfigured_category": "⚠ Родительская категория", "unconfigured_category": "⚠ Родительская категория",
"configured_prefix": " Префикс команд: `{0}`", "configured_channel": "☑ Родительский канал: `{0}`",
"configured_channel": "☑ Родительский канал: **{0}**", "configured_category": "☑ Родительская категория: `{0}`",
"configured_category": "☑ Родительская категория: **{0}**",
"name_voice": "Канал {0}", "name_voice": "Канал {0}",
"name_nomic": "без-микро-{0}", "name_nomic": "без-микро-{0}",
"description_nomic": "Текстовый канал для коммуникации без микрофона\nID голосовой комнаты: {0}" "description_nomic": "Текстовый канал для коммуникации без микрофона\nID голосовой комнаты: {0}"
} }
} }

View File

@@ -1,34 +1,39 @@
{ {
"messages": { "messages": {
"shutdown": "Вимикаюсь...", "shutdown": "Вимикаюсь...",
"locale_set": "Мова бота була змінена на **Українську**", "locale_name": "Українська",
"help": "**Перелік команд:**\n{0}• Встановити твірний канал: `{1}channel ID-КАНАЛА`\n• Встановити твірну категорію: `{2}category ID-КАТЕГОРІЇ`\n• Встановити префікс команд: `{3}prefix СИМВОЛ`\n\nДля скидання каналу/категорії/префіксу використовуйте `reset` як аргумент\n\nЗверніть увагу, що назва каналу/категорії ≠ ID каналу/категорії", "locale_set": "Мова бота на сервері була змінена на `Українську`",
"help": "**Перелік команд:**\n{0}• Встановити твірний канал: `{1}channel ID-КАНАЛА`\n• Встановити твірну категорію: `{2}category ID-КАТЕГОРІЇ`\n• Встановити префікс команд: `{3}prefix СИМВОЛ`\n• Змінити мову бота на сервері: `{4}locale МОВА`\n\nДля скидання каналу/категорії/префіксу використовуйте `reset` як аргумент\n\nЗверніть увагу, що назва каналу/категорії ≠ ID каналу/категорії",
"help_owner": "• Вимкнутись: `{0}shutdown`\n", "help_owner": "• Вимкнутись: `{0}shutdown`\n",
"command_in_dm": "Команди можна виконувати тільки знаходячись на сервері", "command_in_dm": "Команди можна виконувати тільки знаходячись на сервері",
"command_forbidden": "Для налаштування приватних каналів потрібно мати право **Адміністратор** на сервері", "command_forbidden": "Для налаштування приватних каналів потрібно мати право **Адміністратор** на сервері",
"usage_channel": "Правильне використання: `{0}channel ID-КАНАЛА`\nЗверніть увагу, що назва канала ≠ ID канала.\nДізнайтеся більше про це тут: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID", "usage_channel": "Правильне використання: `{0}channel ID-КАНАЛА`\nЗверніть увагу, що назва канала ≠ ID канала.\nДізнайтеся більше про це тут: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID",
"usage_category": "Правильне використання: `{0}category ID-КАТЕГОРІЇ`\nЗверніть увагу, що назва категорії ≠ ID категорії.\nДізнайтеся більше про це тут: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID", "usage_category": "Правильне використання: `{0}category ID-КАТЕГОРІЇ`\nЗверніть увагу, що назва категорії ≠ ID категорії.\nДізнайтеся більше про це тут: https://support.discord.com/hc/articles/206346498-Where-can-I-find-my-User-Server-Message-ID",
"usage_prefix": "Правильне використання: `{0}prefix СИМВОЛ`", "usage_prefix": "Правильне використання: `{0}prefix СИМВОЛ`",
"usage_locale": "Правильне використання: `{0}locale МОВА`\nДоступні мови: {1}",
"result_channel": "Голосовий канал **{0}** було встановлено як твірний", "result_channel": "Голосовий канал **{0}** було встановлено як твірний",
"result_category": "Категорія **{0}** була встановлена як твірна", "result_category": "Категорія **{0}** була встановлена як твірна",
"result_prefix": "Префікс **{0}** було встановлено як основний для цього сервера", "result_prefix": "Префікс **{0}** було встановлено як основний для цього сервера",
"warn_channel": "⚠ Твірний канал не встановлено!\nДля роботи робота потрібно встановити канал: `{0}channel ID-КАНАЛА`", "warn_channel": "⚠ Твірний канал не встановлено!\nДля роботи робота потрібно встановити канал: `{0}channel ID-КАНАЛА`",
"warn_category": "⚠ Твірна категорія не встановлена!\nДля роботи робота потрібно встановити категорію: `{0}category ID-КАТЕГОРІЇ`", "warn_category": "⚠ Твірна категорія не встановлена!\nДля роботи робота потрібно встановити категорію: `{0}category ID-КАТЕГОРІЇ`",
"warn_text_channel": "⚠ Обраний канал є текстовим!\nБудь ласка, вкажіть ID голосового каналу.",
"reset_channel": "Твірний голосовий канал було скинуто", "reset_channel": "Твірний голосовий канал було скинуто",
"reset_category": "Твірну категорію було скинуто", "reset_category": "Твірну категорію було скинуто",
"reset_prefix": "Префікс команд було скинуто, тепер це `{0}`", "reset_prefix": "Префікс команд було скинуто, тепер це `{0}`",
"reset_locale": "Мову бота на цьому сервері було скинуто, тепер це `{0}`",
"none_channel": "Твірний голосовий канал не було задано", "none_channel": "Твірний голосовий канал не було задано",
"none_category": "Твірну категорію не було задано", "none_category": "Твірну категорію не було задано",
"none_prefix": "Префікс команд не було задано, використовується стандартний `{0}`", "none_prefix": "Префікс команд не було задано, використовується стандартний `{0}`",
"server_config": "**Статус сервера:**\n{0}\n{1}\n{2}\n\n", "none_locale": "Мова бота на сервері не була задана, використовується стандартна: `{0}`",
"unconfigured_prefix": " Префікс команд: `{0}`", "server_config": "**Статус сервера:**\n{0}\n{1}\n{2}\n{3}\n\n",
"info_prefix": " Префікс команд: `{0}`",
"info_locale": " Мова бота на сервері: `{0}`",
"unconfigured_channel": "⚠ Твірний канал", "unconfigured_channel": "⚠ Твірний канал",
"unconfigured_category": "⚠ Твірна категорія", "unconfigured_category": "⚠ Твірна категорія",
"configured_prefix": " Префікс команд: `{0}`", "configured_channel": "☑ Твірний канал: `{0}`",
"configured_channel": "☑ Твірний канал: **{0}**", "configured_category": "☑ Твірна категорія: `{0}`",
"configured_category": "☑ Твірна категорія: **{0}**",
"name_voice": "Канал {0}", "name_voice": "Канал {0}",
"name_nomic": "без-мікро-{0}", "name_nomic": "без-мікро-{0}",
"description_nomic": "Текстовий канал для комунікації без мікрофона\nID голосової кімнати: {0}" "description_nomic": "Текстовий канал для комунікації без мікрофона\nID голосової кімнати: {0}"
} }
} }

3
start.bat Normal file
View File

@@ -0,0 +1,3 @@
title YusarinBot
cls
python3 yusarin.py

2
start.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
python3 yusarin.py

View File

@@ -1,4 +1,9 @@
import json, os, sys import os
import sys
import json
import shutil
import requests
import threading
try: try:
import discord import discord
@@ -7,65 +12,60 @@ except Exception as exp:
sys.exit() sys.exit()
from functions import * from functions import *
#from discord_slash import SlashCommand, SlashContext
pid = os.getpid() pid = os.getpid()
version = 1.3
if loadJson("config.json")["check_for_updates"]:
try:
serv_ver = requests.get("https://www.end-play.xyz/yusarin/version.txt").text.replace('\n', '')
if float(serv_ver) > version:
appendLog(f"YusarinBot version {serv_ver} is available. Download new version here: https://github.com/profitrollgame/YusarinBot/releases/latest")
appendLog(f"Currently using YusarinBot v{str(version)}")
except Exception as exp:
appendLog(f"Could not get YusarinBot cloud version due to {exp}. Currently using {str(version)}")
intents = discord.Intents().all() intents = discord.Intents().all()
client = discord.Client(intents=intents) client = discord.Client(intents=intents)
#slash = SlashCommand(client)
@client.event @client.event
async def on_ready(): async def on_ready():
print('Logged in as {0.user}'.format(client)) appendLog(f"Logged in as {client.user}")
config = loadJson("config.json") config = loadJson("config.json")
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=config["bot_activity"])) await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=config["bot_activity"]))
await clearTrash(client)
@client.event
async def on_guild_join(guild):
global path global path
if not os.path.isdir(f"{path}/guilds/"): os.mkdir(f"{path}/guilds/{str(guild.id)}")
os.mkdir(f"{path}/guilds") os.mkdir(f"{path}/guilds/{str(guild.id)}/channels")
saveJson({}, f"{path}/guilds/{str(guild.id)}/config.json")
guilds_list = os.listdir(f"{path}/guilds/") appendLog(f"Joined guild '{guild}' with id {str(guild.id)}")
for guild in guilds_list:
guild_object = client.get_guild(int(guild))
if os.path.isdir(f"{path}/guilds/{guild}/channels"):
channels_list = os.listdir(f"{path}/guilds/{guild}/channels/")
for channel in channels_list:
channel_id = channel[:-5]
try:
selected_channel = discord.utils.get(guild_object.voice_channels, id=int(channel_id))
channel_owner = loadJson(f"{path}/guilds/{guild}/channels/{channel}")["ownerid"]
remove_channel = True
for member in selected_channel.members:
if member.id == channel_owner:
remove_channel = False
if remove_channel:
await removeUserVoice(selected_channel)
except:
os.remove(f"{path}/guilds/{guild}/channels/{channel_id}.json")
@client.event
async def on_guild_remove(guild):
global path
try:
shutil.rmtree(f"{path}/guilds/{str(guild.id)}")
except:
pass
appendLog(f"Left guild '{guild}' with id {str(guild.id)}")
@client.event @client.event
async def on_voice_state_update(member, before, after): async def on_voice_state_update(member, before, after):
global debug
config = loadJson("config.json") config = loadJson("config.json")
vc_from = before.channel vc_from = before.channel
@@ -89,15 +89,18 @@ async def on_voice_state_update(member, before, after):
await changeNomicPerms("deny", vc_from, member) await changeNomicPerms("deny", vc_from, member)
if isUserVoice(vc_to): if isUserVoice(vc_to):
await changeNomicPerms("allow", vc_to, member) await changeNomicPerms("allow", vc_to, member)
if vc_to.id == guildConfGet(vc_to.guild.id, "channel"): if vc_to.id == guildConfGet(vc_to.guild, "channel"):
if guildConfGet(vc_to.guild.id, "category") is not None: if guildConfGet(vc_to.guild, "category") is not None:
voice_chan = await createUserVoice(vc_to, discord.utils.get(vc_to.guild.categories, id=guildConfGet(vc_to.guild.id, "category")), member) voice_chan = await createUserVoice(vc_to, discord.utils.get(vc_to.guild.categories, id=guildConfGet(vc_to.guild, "category")), member)
try: try:
await member.move_to(voice_chan) await member.move_to(voice_chan)
except: except:
await removeUserVoice(voice_chan) await removeUserVoice(voice_chan)
else: else:
appendLog(f"Category for guild {str(vc_to.guild.id)} is not set", guild=vc_to.guild.id) if debug:
appendLog(f"Category for guild {vc_to.guild} ({str(vc_to.guild.id)}) is not set", guild=vc_to.guild)
else:
appendLog(f"Category for guild {vc_to.guild} is not set", guild=vc_to.guild)
# ========================================================================================== # ==========================================================================================
@@ -108,7 +111,7 @@ async def on_message(message):
if message.guild is not None: if message.guild is not None:
try: try:
prefix = guildConfGet(message.guild.id, "prefix") prefix = guildConfGet(message.guild, "prefix")
if prefix is None: if prefix is None:
prefix = config["bot_prefix"] prefix = config["bot_prefix"]
except Exception as exp: except Exception as exp:
@@ -123,9 +126,11 @@ async def on_message(message):
if message.content in [f"{prefix}reboot", f"{prefix}restart", f"{prefix}shutdown", f"{prefix}die"]: if message.content in [f"{prefix}reboot", f"{prefix}restart", f"{prefix}shutdown", f"{prefix}die"]:
gotCommand(message)
if message.author.id == config["owner"]: if message.author.id == config["owner"]:
await message.channel.send(getMsg("shutdown")) await message.channel.send(getMsg("shutdown", message.guild))
os.system(f"kill -9 {str(pid)}") os.system(f"kill -9 {str(pid)}")
else: else:
@@ -134,6 +139,8 @@ async def on_message(message):
elif message.content.startswith(f"{prefix}channel"): elif message.content.startswith(f"{prefix}channel"):
gotCommand(message)
fullcmd = message.content.split() fullcmd = message.content.split()
if message.guild is not None: if message.guild is not None:
@@ -144,43 +151,53 @@ async def on_message(message):
if fullcmd[1] == "reset": if fullcmd[1] == "reset":
if guildConfGet(message.guild.id, "channel") is not None: if guildConfGet(message.guild, "channel") is not None:
guildConfReset(message.guild.id, "channel") guildConfReset(message.guild, "channel")
await message.channel.send(getMsg("reset_channel")) await message.channel.send(getMsg("reset_channel", message.guild))
else: else:
await message.channel.send(getMsg("none_channel")) await message.channel.send(getMsg("none_channel", message.guild))
else: else:
selected_channel = discord.utils.get(message.guild.channels, id=int(fullcmd[1])) selected_channel = discord.utils.get(message.guild.channels, id=int(fullcmd[1]))
if isinstance(selected_channel, discord.VoiceChannel):
guildConfSet(message.guild.id, "channel", int(fullcmd[1])) guildConfSet(message.guild, "channel", int(fullcmd[1]))
await message.channel.send(getMsg("result_channel").format(selected_channel.name)) await message.channel.send(getMsg("result_channel", message.guild).format(selected_channel.name))
if guildConfGet(message.guild.id, "category") is None: if guildConfGet(message.guild, "category") is None:
await message.channel.send(getMsg("warn_category").format(prefix)) await message.channel.send(getMsg("warn_category", message.guild).format(prefix))
else:
print(type(selected_channel))
await message.channel.send(getMsg("warn_text_channel", message.guild))
except Exception as exp: except Exception as exp:
#print(exp) print(exp)
await message.channel.send(getMsg("usage_channel").format(prefix)) await message.channel.send(getMsg("usage_channel", message.guild).format(prefix))
else: else:
await message.channel.send(getMsg("command_forbidden")) await message.channel.send(getMsg("command_forbidden", message.guild))
else: else:
await message.channel.send(getMsg("command_in_dm")) await message.channel.send(getMsg("command_in_dm"))
elif message.content.startswith(f"{prefix}category"): elif message.content.startswith(f"{prefix}category"):
gotCommand(message)
fullcmd = message.content.split() fullcmd = message.content.split()
if message.guild is not None: if message.guild is not None:
@@ -191,43 +208,45 @@ async def on_message(message):
if fullcmd[1] == "reset": if fullcmd[1] == "reset":
if guildConfGet(message.guild.id, "category") is not None: if guildConfGet(message.guild, "category") is not None:
guildConfReset(message.guild.id, "category") guildConfReset(message.guild, "category")
await message.channel.send(getMsg("reset_category")) await message.channel.send(getMsg("reset_category", message.guild))
else: else:
await message.channel.send(getMsg("none_category")) await message.channel.send(getMsg("none_category", message.guild))
else: else:
selected_category = discord.utils.get(message.guild.channels, id=int(fullcmd[1])) selected_category = discord.utils.get(message.guild.channels, id=int(fullcmd[1]))
guildConfSet(message.guild.id, "category", int(fullcmd[1])) guildConfSet(message.guild, "category", int(fullcmd[1]))
await message.channel.send(getMsg("result_category").format(selected_category.name)) await message.channel.send(getMsg("result_category", message.guild).format(selected_category.name))
if guildConfGet(message.guild.id, "channel") is None: if guildConfGet(message.guild, "channel") is None:
await message.channel.send(getMsg("warn_channel").format(prefix)) await message.channel.send(getMsg("warn_channel", message.guild).format(prefix))
except Exception as exp: except Exception as exp:
#print(exp) #print(exp)
await message.channel.send(getMsg("usage_category").format(prefix)) await message.channel.send(getMsg("usage_category", message.guild).format(prefix))
else: else:
await message.channel.send(getMsg("command_forbidden")) await message.channel.send(getMsg("command_forbidden", message.guild))
else: else:
await message.channel.send(getMsg("command_in_dm")) await message.channel.send(getMsg("command_in_dm"))
elif message.content.startswith(f"{prefix}prefix"): elif message.content.startswith(f"{prefix}prefix"):
gotCommand(message)
fullcmd = message.content.split() fullcmd = message.content.split()
if message.guild is not None: if message.guild is not None:
@@ -238,42 +257,105 @@ async def on_message(message):
if fullcmd[1] == "reset": if fullcmd[1] == "reset":
if guildConfGet(message.guild.id, "prefix") is not None: if guildConfGet(message.guild, "prefix") is not None:
guildConfReset(message.guild.id, "prefix") guildConfReset(message.guild, "prefix")
await message.channel.send(getMsg("reset_prefix").format(config["bot_prefix"])) await message.channel.send(getMsg("reset_prefix", message.guild).format(config["bot_prefix"]))
else: else:
await message.channel.send(getMsg("none_prefix").format(prefix)) await message.channel.send(getMsg("none_prefix", message.guild).format(prefix))
else: else:
guildConfSet(message.guild.id, "prefix", fullcmd[1]) guildConfSet(message.guild, "prefix", fullcmd[1])
await message.channel.send(getMsg("result_prefix").format(fullcmd[1])) await message.channel.send(getMsg("result_prefix", message.guild).format(fullcmd[1]))
except: except:
await message.channel.send(getMsg("usage_prefix").format(prefix)) await message.channel.send(getMsg("usage_prefix", message.guild).format(prefix))
else: else:
await message.channel.send(getMsg("command_forbidden")) await message.channel.send(getMsg("command_forbidden", message.guild))
else:
await message.channel.send(getMsg("command_in_dm"))
elif message.content.startswith(f"{prefix}locale"):
gotCommand(message)
fullcmd = message.content.split()
if message.guild is not None:
if message.author.guild_permissions.administrator:
try:
if fullcmd[1] == "reset":
if guildConfGet(message.guild, "locale") is not None:
guildConfReset(message.guild, "locale")
appendLog(f"Server's locale has been reset", message.guild)
await message.channel.send(getMsg("reset_locale", message.guild).format(getMsg("locale_name", message.guild)))
else:
await message.channel.send(getMsg("none_locale", message.guild).format(getMsg("locale_name", message.guild)))
else:
for locale_file in os.listdir(f"{path}/locale/"):
if locale_file[:-5] == fullcmd[1]:
guildConfSet(message.guild, "locale", fullcmd[1])
appendLog(f"Server's locale is now set to {fullcmd[1]}", message.guild)
await message.channel.send(getMsg("locale_set", message.guild))
return
locales = []
for locale_file in os.listdir(f"{path}/locale/"):
locales.append(f"`{locale_file[:-5]}`")
await message.channel.send(getMsg("usage_locale", message.guild).format(prefix, ", ".join(locales)))
except:
locales = []
for locale_file in os.listdir(f"{path}/locale/"):
locales.append(f"`{locale_file[:-5]}`")
await message.channel.send(getMsg("usage_locale", message.guild).format(prefix, ", ".join(locales)))
else:
await message.channel.send(getMsg("command_forbidden", message.guild))
else: else:
await message.channel.send(getMsg("command_in_dm")) await message.channel.send(getMsg("command_in_dm"))
elif message.content.startswith(f"{prefix}help"): elif message.content.startswith(f"{prefix}help"):
gotCommand(message)
if message.author.id == config["owner"]: if message.author.id == config["owner"]:
if message.guild is not None: if message.guild is not None:
await message.channel.send(await guildConfigured(message.guild) + getMsg("help").format(getMsg("help_owner").format(prefix), prefix, prefix, prefix, prefix)) await message.channel.send(await guildConfigured(message.guild) + getMsg("help", message.guild).format(getMsg("help_owner", message.guild).format(prefix), prefix, prefix, prefix, prefix, prefix))
else: else:
await message.channel.send(getMsg("help").format(getMsg("help_owner").format(prefix), prefix, prefix, prefix, prefix)) await message.channel.send(getMsg("help").format(getMsg("help_owner").format(prefix), prefix, prefix, prefix, prefix, prefix))
else: else:
if message.guild is not None: if message.guild is not None:
await message.channel.send(await guildConfigured(message.guild) + getMsg("help").format("", prefix, prefix, prefix)) await message.channel.send(await guildConfigured(message.guild) + getMsg("help", message.guild).format("", prefix, prefix, prefix, prefix))
else: else:
await message.channel.send(getMsg("help").format("", prefix, prefix, prefix)) await message.channel.send(getMsg("help").format("", prefix, prefix, prefix, prefix))
client.run(loadJson("config.json")["bot_token"]) #if loadJson("config.json")["auto_clear_trash"]:
# run func
appendLog(f"Trying to log in...")
client.run(loadJson("config.json")["bot_token"])