diff --git a/bot/integral_lib/__init__.py b/bot/integral_lib/__init__.py deleted file mode 100644 index 0f3186d..0000000 --- a/bot/integral_lib/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -""" -integral_lib -~~~~~~~~~~~~~ -Some libs for the bot which help him -""" diff --git a/bot/__init__.py b/src/__init__.py similarity index 95% rename from bot/__init__.py rename to src/__init__.py index 0304c54..2a4aa87 100644 --- a/bot/__init__.py +++ b/src/__init__.py @@ -1,5 +1,5 @@ __version__ = '0.0.7' -__title__ = "bot" +__title__ = "src" __author__ = "baconborn" from typing import NamedTuple, Literal diff --git a/bot/audio/scav2_attention_01_bl.wav b/src/audio/scav2_attention_01_bl.wav similarity index 100% rename from bot/audio/scav2_attention_01_bl.wav rename to src/audio/scav2_attention_01_bl.wav diff --git a/bot/audio/scav2_enemy_contact_01_l.wav b/src/audio/scav2_enemy_contact_01_l.wav similarity index 100% rename from bot/audio/scav2_enemy_contact_01_l.wav rename to src/audio/scav2_enemy_contact_01_l.wav diff --git a/bot/audio/scav2_enemy_contact_07_l.wav b/src/audio/scav2_enemy_contact_07_l.wav similarity index 100% rename from bot/audio/scav2_enemy_contact_07_l.wav rename to src/audio/scav2_enemy_contact_07_l.wav diff --git a/bot/audio/scav2_enemy_contact_15_l.wav b/src/audio/scav2_enemy_contact_15_l.wav similarity index 100% rename from bot/audio/scav2_enemy_contact_15_l.wav rename to src/audio/scav2_enemy_contact_15_l.wav diff --git a/bot/audio/scav2_enemy_contact_22_bl.wav b/src/audio/scav2_enemy_contact_22_bl.wav similarity index 100% rename from bot/audio/scav2_enemy_contact_22_bl.wav rename to src/audio/scav2_enemy_contact_22_bl.wav diff --git a/bot/audio/scav2_enemy_contact_26_bl.wav b/src/audio/scav2_enemy_contact_26_bl.wav similarity index 100% rename from bot/audio/scav2_enemy_contact_26_bl.wav rename to src/audio/scav2_enemy_contact_26_bl.wav diff --git a/bot/audio/scav2_enemy_usec_10_bl.wav b/src/audio/scav2_enemy_usec_10_bl.wav similarity index 100% rename from bot/audio/scav2_enemy_usec_10_bl.wav rename to src/audio/scav2_enemy_usec_10_bl.wav diff --git a/bot/audio/scav2_enemy_usec_11_bl.wav b/src/audio/scav2_enemy_usec_11_bl.wav similarity index 100% rename from bot/audio/scav2_enemy_usec_11_bl.wav rename to src/audio/scav2_enemy_usec_11_bl.wav diff --git a/bot/audio/scav2_enemy_usec_14_bl.wav b/src/audio/scav2_enemy_usec_14_bl.wav similarity index 100% rename from bot/audio/scav2_enemy_usec_14_bl.wav rename to src/audio/scav2_enemy_usec_14_bl.wav diff --git a/bot/audio/scav2_enemy_usec_15_bl.wav b/src/audio/scav2_enemy_usec_15_bl.wav similarity index 100% rename from bot/audio/scav2_enemy_usec_15_bl.wav rename to src/audio/scav2_enemy_usec_15_bl.wav diff --git a/bot/audio/scav2_enemy_usec_16_bl.wav b/src/audio/scav2_enemy_usec_16_bl.wav similarity index 100% rename from bot/audio/scav2_enemy_usec_16_bl.wav rename to src/audio/scav2_enemy_usec_16_bl.wav diff --git a/bot/audio/scav2_mutter_06.wav b/src/audio/scav2_mutter_06.wav similarity index 100% rename from bot/audio/scav2_mutter_06.wav rename to src/audio/scav2_mutter_06.wav diff --git a/bot/audio/scav2_mutter_27_bl.wav b/src/audio/scav2_mutter_27_bl.wav similarity index 100% rename from bot/audio/scav2_mutter_27_bl.wav rename to src/audio/scav2_mutter_27_bl.wav diff --git a/bot/audio/scav3_enemy_bear_03.wav b/src/audio/scav3_enemy_bear_03.wav similarity index 100% rename from bot/audio/scav3_enemy_bear_03.wav rename to src/audio/scav3_enemy_bear_03.wav diff --git a/bot/audio/scav3_enemy_bear_04.wav b/src/audio/scav3_enemy_bear_04.wav similarity index 100% rename from bot/audio/scav3_enemy_bear_04.wav rename to src/audio/scav3_enemy_bear_04.wav diff --git a/bot/audio/scav3_enemy_bear_06_bl.wav b/src/audio/scav3_enemy_bear_06_bl.wav similarity index 100% rename from bot/audio/scav3_enemy_bear_06_bl.wav rename to src/audio/scav3_enemy_bear_06_bl.wav diff --git a/bot/audio/scav3_enemy_contact_01_l.wav b/src/audio/scav3_enemy_contact_01_l.wav similarity index 100% rename from bot/audio/scav3_enemy_contact_01_l.wav rename to src/audio/scav3_enemy_contact_01_l.wav diff --git a/bot/audio/scav3_enemy_contact_07_l.wav b/src/audio/scav3_enemy_contact_07_l.wav similarity index 100% rename from bot/audio/scav3_enemy_contact_07_l.wav rename to src/audio/scav3_enemy_contact_07_l.wav diff --git a/bot/audio/scav3_enemy_usec_01.wav b/src/audio/scav3_enemy_usec_01.wav similarity index 100% rename from bot/audio/scav3_enemy_usec_01.wav rename to src/audio/scav3_enemy_usec_01.wav diff --git a/bot/audio/scav3_enemy_usec_03.wav b/src/audio/scav3_enemy_usec_03.wav similarity index 100% rename from bot/audio/scav3_enemy_usec_03.wav rename to src/audio/scav3_enemy_usec_03.wav diff --git a/bot/audio/scav3_enemy_usec_08.wav b/src/audio/scav3_enemy_usec_08.wav similarity index 100% rename from bot/audio/scav3_enemy_usec_08.wav rename to src/audio/scav3_enemy_usec_08.wav diff --git a/bot/audio/scav3_enemy_usec_16_bl.wav b/src/audio/scav3_enemy_usec_16_bl.wav similarity index 100% rename from bot/audio/scav3_enemy_usec_16_bl.wav rename to src/audio/scav3_enemy_usec_16_bl.wav diff --git a/bot/audio/scav3_mutter_30.wav b/src/audio/scav3_mutter_30.wav similarity index 100% rename from bot/audio/scav3_mutter_30.wav rename to src/audio/scav3_mutter_30.wav diff --git a/bot/audio/scav3_mutter_34_bl.wav b/src/audio/scav3_mutter_34_bl.wav similarity index 100% rename from bot/audio/scav3_mutter_34_bl.wav rename to src/audio/scav3_mutter_34_bl.wav diff --git a/bot/bot.py b/src/bot.py similarity index 100% rename from bot/bot.py rename to src/bot.py diff --git a/bot/cogs/admin.py b/src/cogs/admin.py similarity index 92% rename from bot/cogs/admin.py rename to src/cogs/admin.py index 7d3a912..7471df0 100644 --- a/bot/cogs/admin.py +++ b/src/cogs/admin.py @@ -11,7 +11,7 @@ from integral_lib.Logger import logger class Admin(commands.Cog, name='Admin'): def __init__(self, bot: commands.Bot): - self.bot = bot # a defining bot as global var in class + self.bot = bot # a defining src as global var in class @commands.Cog.listener() # this is a decorator for events/listeners async def on_ready(self): @@ -54,7 +54,7 @@ class Admin(commands.Cog, name='Admin'): async def on_member_join(self, member): await fill_bd(member.name, member.id, member.bot, member.nick, member.guild.id) - bot_role = read_json(member.guild.id, 'bot_role') # Get bot role + bot_role = read_json(member.guild.id, 'bot_role') # Get src role guest_role = read_json(member.guild.id, 'guest_role') # Get guest role if bot_role or guest_role: @@ -67,7 +67,7 @@ class Admin(commands.Cog, name='Admin'): @commands.slash_command( name="set_default_role", - description=Localized("Set Default bot role", key="DEF_ROLE"), + description=Localized("Set Default src role", key="DEF_ROLE"), options=[ Option("role", "Specify role", @@ -78,7 +78,7 @@ class Admin(commands.Cog, name='Admin'): @commands.has_permissions(administrator=True) async def set_guest_role(self, inter: disnake.ApplicationCommandInteraction, role): await write_json(inter.guild.id, "guest_role", role.id) - await inter.response.send_message(f"Set up bot role to: `{role.name}`", ephemeral=True) + await inter.response.send_message(f"Set up src role to: `{role.name}`", ephemeral=True) @commands.command(name="set_prefix") @commands.has_permissions(administrator=True) @@ -89,7 +89,7 @@ class Admin(commands.Cog, name='Admin'): @commands.guild_only() @commands.slash_command( name="set_prefix", - description="Setting up bot prefix", + description="Setting up src prefix", options=[ Option("prefix", "Specify prefix", @@ -106,7 +106,7 @@ class Admin(commands.Cog, name='Admin'): @commands.has_permissions(administrator=True) @commands.slash_command( name="set_trigger_role", - description=Localized("Setting up role to trigger bot", key="KEY_ROLE"), + description=Localized("Setting up role to trigger src", key="KEY_ROLE"), options=[ Option("role", Localized("Specify role", key="SETUP_ROLE"), @@ -120,7 +120,7 @@ class Admin(commands.Cog, name='Admin'): @commands.slash_command( name="set_bot_role", - description=Localized("Set bot role", key="BOT_ROLE"), + description=Localized("Set src role", key="BOT_ROLE"), options=[ Option("role", Localized("Specify role", key="SETUP_ROLE"), @@ -134,7 +134,7 @@ class Admin(commands.Cog, name='Admin'): await write_json(ctx.guild.id, "bot_role", role.id) - await ctx.send(f"Set up bot role to: `{role.name}`", ephemeral=True) + await ctx.send(f"Set up src role to: `{role.name}`", ephemeral=True) @set_bot_role.error @set_trigger_role.error diff --git a/bot/cogs/audio.py b/src/cogs/audio.py similarity index 98% rename from bot/cogs/audio.py rename to src/cogs/audio.py index 9a98d73..a611e9f 100644 --- a/bot/cogs/audio.py +++ b/src/cogs/audio.py @@ -27,7 +27,7 @@ class Audio(commands.Cog, name='Audio'): logger.info('Skip playing by Game') else: # Prepare list of audio - from bot.integral_lib.Comands import read_json + from src.integral_lib.Comands import read_json _role = await read_json(member.guild.id, 'tigger_role') audio: list = [] for _a in ListGenerator('audio'): diff --git a/bot/cogs/disabled/funny.py b/src/cogs/disabled/funny.py similarity index 92% rename from bot/cogs/disabled/funny.py rename to src/cogs/disabled/funny.py index f88037b..7bab201 100644 --- a/bot/cogs/disabled/funny.py +++ b/src/cogs/disabled/funny.py @@ -10,7 +10,7 @@ from integral_lib.Logger import logger class Fun(commands.Cog, name='Fun'): def __init__(self, bot: commands.Bot): - self.bot = bot # defining bot as global var in class + self.bot = bot # defining src as global var in class @commands.Cog.listener() # this is a decorator for events/listeners async def on_ready(self): @@ -19,7 +19,7 @@ class Fun(commands.Cog, name='Fun'): @commands.has_permissions(administrator=True) @commands.slash_command( name="set_bot_channel", - description="Set channel which iterate with bot", + description="Set channel which iterate with src", ) async def set_bot_channel(self, inter: disnake.ApplicationCommandInteraction, channel: str): diff --git a/bot/cogs/disabled/test.py b/src/cogs/disabled/test.py similarity index 94% rename from bot/cogs/disabled/test.py rename to src/cogs/disabled/test.py index cfd6cbc..76704ef 100644 --- a/bot/cogs/disabled/test.py +++ b/src/cogs/disabled/test.py @@ -8,7 +8,7 @@ from integral_lib.Logger import logger class Testing(commands.Cog, name='Testing'): def __init__(self, bot: commands.Bot): - self.bot = bot # defining bot as global var in class + self.bot = bot # defining src as global var in class @commands.Cog.listener() # this is a decorator for events/listeners async def on_ready(self): diff --git a/bot/cogs/general.py b/src/cogs/general.py similarity index 96% rename from bot/cogs/general.py rename to src/cogs/general.py index 7b59ef7..036d375 100644 --- a/bot/cogs/general.py +++ b/src/cogs/general.py @@ -7,7 +7,7 @@ from integral_lib.Logger import logger class General(commands.Cog): def __init__(self, bot: commands.Bot): - self.bot = bot # defining bot as global var in class + self.bot = bot # defining src as global var in class @commands.Cog.listener() # this is a decorator for events/listeners async def on_ready(self): diff --git a/bot/cogs/info.py b/src/cogs/info.py similarity index 91% rename from bot/cogs/info.py rename to src/cogs/info.py index 207ff74..97e912c 100644 --- a/bot/cogs/info.py +++ b/src/cogs/info.py @@ -12,20 +12,20 @@ from integral_lib.Logger import logger class BotInfo(commands.Cog, name='Bot Info'): def __init__(self, bot: commands.Bot): - self.bot = bot # defining bot as global var in class + self.bot = bot # defining src as global var in class @commands.Cog.listener() # this is a decorator for events/listeners async def on_ready(self): logger.info(f'Cog {__name__.split(".")[1]} is ready!.') @commands.slash_command(name="info_bot", - description='Shows general info about bot') # this is for making a command + description='Shows general info about src') # this is for making a command async def info_bot(self, inter: ApplicationCommandInteraction): _pid = os.getpid() _process = psutil.Process(_pid) emb = disnake.Embed( title="General information", - description="General information on about bot", + description="General information on about src", ) emb.set_thumbnail(self.bot.user.avatar.url) emb.add_field(name="System info:", value=f"Memory Usage: {round(_process.memory_info().rss / 2 ** 20, 2)} Mb\n" diff --git a/bot/integral_lib/CogsPrep.py b/src/integral_lib/CogsPrep.py similarity index 97% rename from bot/integral_lib/CogsPrep.py rename to src/integral_lib/CogsPrep.py index c9dceef..8af92bc 100644 --- a/bot/integral_lib/CogsPrep.py +++ b/src/integral_lib/CogsPrep.py @@ -38,7 +38,7 @@ def work_with_cogs(what_do: str, Perform the specified action on the given cog or list of cogs. Args: what_do (str): The action to perform (load, unload, reload, disable, enable). - bot (InteractionBotBase): The bot instance to work with. + src (InteractionBotBase): The src instance to work with. cog (str | list): The name of the cog or a list of cogs to work with. Raises: ValueError: If the action is not recognized. diff --git a/bot/integral_lib/Comands.py b/src/integral_lib/Comands.py similarity index 97% rename from bot/integral_lib/Comands.py rename to src/integral_lib/Comands.py index 7c2f1d2..60e9055 100644 --- a/bot/integral_lib/Comands.py +++ b/src/integral_lib/Comands.py @@ -66,7 +66,7 @@ async def write_json(guild: int, param_name: str, param: str or int): def determine_prefix(bot: commands.Bot, msg): """ - Determine the per-server bot prefix based on the given message object. + Determine the per-server src prefix based on the given message object. :param bot: Disnake Bot object :param msg: Disnake msg object diff --git a/bot/integral_lib/DB_Worker.py b/src/integral_lib/DB_Worker.py similarity index 100% rename from bot/integral_lib/DB_Worker.py rename to src/integral_lib/DB_Worker.py diff --git a/bot/integral_lib/ListGenerator.py b/src/integral_lib/ListGenerator.py similarity index 100% rename from bot/integral_lib/ListGenerator.py rename to src/integral_lib/ListGenerator.py diff --git a/bot/integral_lib/Logger.py b/src/integral_lib/Logger.py similarity index 100% rename from bot/integral_lib/Logger.py rename to src/integral_lib/Logger.py diff --git a/bot/integral_lib/Player.py b/src/integral_lib/Player.py similarity index 100% rename from bot/integral_lib/Player.py rename to src/integral_lib/Player.py diff --git a/bot/integral_lib/YandexPlayer.py b/src/integral_lib/YandexPlayer.py similarity index 100% rename from bot/integral_lib/YandexPlayer.py rename to src/integral_lib/YandexPlayer.py diff --git a/src/integral_lib/__init__.py b/src/integral_lib/__init__.py new file mode 100644 index 0000000..f738f12 --- /dev/null +++ b/src/integral_lib/__init__.py @@ -0,0 +1,5 @@ +""" +integral_lib +~~~~~~~~~~~~~ +Some libs for the src which help him +""" diff --git a/bot/locale/ru.json b/src/locale/ru.json similarity index 100% rename from bot/locale/ru.json rename to src/locale/ru.json diff --git a/tests/test_lib_Cog.py b/tests/test_lib_Cog.py index f35a27d..e3f0e04 100644 --- a/tests/test_lib_Cog.py +++ b/tests/test_lib_Cog.py @@ -1,14 +1,17 @@ +import sys + import pytest from disnake.ext.commands.common_bot_base import CommonBotBase from mock import mock -from integral_lib.CogsPrep import cog_list, work_with_cogs +sys.path.append('src') +from integral_lib import CogsPrep def test_cog_list(): with mock.patch('integral_lib.CogsPrep.listdir') as MockClass: MockClass.return_value = ['cog1.py', 'cog2.py'] - result = cog_list() + result = CogsPrep.cog_list() assert result == ['cog1', 'cog2'] @@ -18,7 +21,7 @@ def test_work_with_cogs(what_do, cog): with mock.patch('integral_lib.CogsPrep.rename') as mock_rename: mock_rename.return_value = None mock_bot = mock.MagicMock(spec=CommonBotBase) - result = work_with_cogs(what_do, mock_bot, cog) + result = CogsPrep.work_with_cogs(what_do, mock_bot, cog) if what_do in ['load', 'enable']: assert mock_bot.load_extension.called elif what_do in ['unload', 'disable']: