Skip to content

Commit

Permalink
Fixing source code
Browse files Browse the repository at this point in the history
  • Loading branch information
KittyNeverDies committed Feb 13, 2024
1 parent 402c4c9 commit 71b33ef
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bozenka/features/admin/information.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aiogram.types import Message

from bozenka.features.main import BasicFeature
from bozenka.instances.telegram.utils.keyboards import delete_keyboard
from bozenka.instances.telegram.utils.delete import delete_keyboard


class ChatInformation(BasicFeature):
Expand Down
1 change: 0 additions & 1 deletion bozenka/features/admin/invite_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def invite_telegram_keyboard(invite_link: str, admin_id: int, chat_name: str) ->
return kb



class Invite(BasicFeature):
"""
A class with information about invite feature
Expand Down
2 changes: 1 addition & 1 deletion bozenka/features/admin/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from bozenka.features.main import BasicFeature
from bozenka.instances.telegram.utils.callbacks_factory import UnbanData, BanData, UnmuteData, MuteData, DeleteMenu
from bozenka.instances.telegram.filters import IsAdminFilter, BotHasPermissions, UserHasPermissions
from bozenka.instances.telegram.utils.keyboards import delete_keyboard
from bozenka.instances.telegram.utils.delete import delete_keyboard
from bozenka.instances.telegram.utils.simpler import SolutionSimpler


Expand Down
2 changes: 1 addition & 1 deletion bozenka/features/admin/msg_pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from bozenka.features.main import BasicFeature
from bozenka.instances.telegram.utils.callbacks_factory import PinMsg, UnpinMsg, DeleteMenu
from bozenka.instances.telegram.filters import UserHasPermissions, BotHasPermissions, IsAdminFilter
from bozenka.instances.telegram.utils.keyboards import delete_keyboard
from bozenka.instances.telegram.utils.delete import delete_keyboard
from bozenka.instances.telegram.utils.simpler import SolutionSimpler


Expand Down
2 changes: 1 addition & 1 deletion bozenka/features/admin/topics.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from bozenka.features.main import BasicFeature
from bozenka.instances.telegram.utils.callbacks_factory import CloseThread, OpenThread, DeleteMenu
from bozenka.instances.telegram.filters import UserHasPermissions, BotHasPermissions
from bozenka.instances.telegram.utils.keyboards import delete_keyboard
from bozenka.instances.telegram.utils.delete import delete_keyboard
from bozenka.instances.telegram.utils.simpler import SolutionSimpler


Expand Down
2 changes: 1 addition & 1 deletion bozenka/features/user/image_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from bozenka.generative.kadinsky import kadinsky_gen
from bozenka.instances.telegram.utils.callbacks_factory import ImageGenerationCategory, ImageGeneration, DeleteMenu, \
GptStop
from bozenka.instances.telegram.utils.keyboards import delete_keyboard
from bozenka.instances.telegram.utils.delete import delete_keyboard
from bozenka.instances.telegram.utils.simpler import GeneratingImages


Expand Down
2 changes: 1 addition & 1 deletion bozenka/features/user/text_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from bozenka.instances.telegram.utils.callbacks_factory import Gpt4FreeProvsModelPage, Gpt4FreeProviderPage, \
Gpt4AllSelect, Gpt4AllModel, GptCategory, Gpt4freeResult, \
Gpt4FreeProvider, GptBackMenu, Gpt4FreeModel, Gpt4FreeCategory, Gpt4FreeModelPage, GptStop
from bozenka.instances.telegram.utils.keyboards import delete_keyboard
from bozenka.instances.telegram.utils.delete import delete_keyboard
from bozenka.instances.telegram.utils.simpler import AnsweringGPT4Free, AnsweringGpt4All


Expand Down
12 changes: 9 additions & 3 deletions bozenka/instances/telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ async def register_all_features(list_of_features: list, dispatcher: Dispatcher,
for callback_query_handler in feature.telegram_callback_handlers:
dispatcher.callback_query.register(callback_query_handler[0], *callback_query_handler[1])

await bot.set_my_commands(cmd_list)
if not (commands := await bot.get_my_commands()):
await bot.set_my_commands(cmd_list)
else:
for cmd in cmd_list:
commands.append(cmd)
await bot.set_my_commands(commands)


async def launch_telegram_instance(session_maker: async_sessionmaker) -> None:
Expand All @@ -46,6 +51,8 @@ async def launch_telegram_instance(session_maker: async_sessionmaker) -> None:

dp = Dispatcher()

await bot.delete_my_commands()

# Registering other handlers
dp.callback_query.register(delete_callback_handler, DeleteMenu.filter())
dp.callback_query.register(hide_menu_handler, HideMenu.filter())
Expand All @@ -56,5 +63,4 @@ async def launch_telegram_instance(session_maker: async_sessionmaker) -> None:
await register_all_features(list_of_features=customizable_features, dispatcher=dp, bot=bot),
await register_all_features(list_of_features=basic_features, dispatcher=dp, bot=bot)

]
)
])
2 changes: 1 addition & 1 deletion bozenka/instances/telegram/filters/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from aiogram.types import Message, ChatPermissions, CallbackQuery
from aiogram.enums import ChatMemberStatus, ChatType

from bozenka.instances.telegram.utils.keyboards import delete_keyboard
from bozenka.instances.telegram.utils.delete import delete_keyboard


class UserHasPermissions(Filter):
Expand Down
4 changes: 0 additions & 4 deletions bozenka/instances/telegram/utils/simpler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
from .solution_simpler import SolutionSimpler
from .lists_of_content import *
from .fsm_states import *



0 comments on commit 71b33ef

Please sign in to comment.