mirror of
https://github.com/kurbezz/discord-bot.git
synced 2025-12-06 07:05:36 +01:00
Refactor
This commit is contained in:
12
.github/workflows/build_docker_image.yml
vendored
12
.github/workflows/build_docker_image.yml
vendored
@@ -49,14 +49,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
url: ${{ secrets.WEBHOOK_URL }}
|
url: ${{ secrets.WEBHOOK_URL }}
|
||||||
|
|
||||||
# -
|
-
|
||||||
# name: Invoke deployment hook (worker)
|
name: Invoke deployment hook (twitch_webhook)
|
||||||
# uses: joelwmale/webhook-action@master
|
uses: joelwmale/webhook-action@master
|
||||||
# with:
|
with:
|
||||||
# url: ${{ secrets.WEBHOOK_URL_2 }}
|
url: ${{ secrets.WEBHOOK_URL_2 }}
|
||||||
|
|
||||||
# -
|
# -
|
||||||
# name: Invoke deployment hook (scheduler)
|
# name: Invoke deployment hook (worker)
|
||||||
# uses: joelwmale/webhook-action@master
|
# uses: joelwmale/webhook-action@master
|
||||||
# with:
|
# with:
|
||||||
# url: ${{ secrets.WEBHOOK_URL_3 }}
|
# url: ${{ secrets.WEBHOOK_URL_3 }}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from domain.streamers import TwitchConfig
|
from applications.common.domain.streamers import TwitchConfig
|
||||||
|
|
||||||
from .twitch_events import get_twitch_events, TwitchEvent
|
from .twitch_events import get_twitch_events, TwitchEvent
|
||||||
from .discord_events import (
|
from .discord_events import (
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
from core.broker import broker
|
from core.broker import broker
|
||||||
from repositories.streamers import StreamerConfigRepository
|
from applications.common.repositories.streamers import StreamerConfigRepository
|
||||||
from .synchronizer import syncronize
|
from .synchronizer import syncronize
|
||||||
|
|
||||||
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
from .twitch.webhook import start_twitch_service
|
|
||||||
|
|
||||||
|
|
||||||
start = start_twitch_service
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["start"]
|
|
||||||
10
src/applications/twitch_webhook/__main__.py
Normal file
10
src/applications/twitch_webhook/__main__.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from asyncio import run
|
||||||
|
|
||||||
|
from .twitch.webhook import TwitchService
|
||||||
|
|
||||||
|
|
||||||
|
async def start_twitch_service() -> None:
|
||||||
|
await TwitchService.start()
|
||||||
|
|
||||||
|
|
||||||
|
run(start_twitch_service())
|
||||||
@@ -3,7 +3,7 @@ import logging
|
|||||||
from httpx import AsyncClient
|
from httpx import AsyncClient
|
||||||
|
|
||||||
from core.config import config
|
from core.config import config
|
||||||
from domain.streamers import StreamerConfig
|
from applications.common.domain.streamers import StreamerConfig
|
||||||
|
|
||||||
from .state import State
|
from .state import State
|
||||||
from .sent_notifications import SentNotification, SentNotificationType, SentResult
|
from .sent_notifications import SentNotification, SentNotificationType, SentResult
|
||||||
@@ -4,7 +4,7 @@ from pydantic import BaseModel
|
|||||||
|
|
||||||
from twitchAPI.object.eventsub import ChannelPointsCustomRewardRedemptionAddEvent
|
from twitchAPI.object.eventsub import ChannelPointsCustomRewardRedemptionAddEvent
|
||||||
|
|
||||||
from repositories.streamers import StreamerConfigRepository
|
from applications.common.repositories.streamers import StreamerConfigRepository
|
||||||
from .twitch.authorize import authorize
|
from .twitch.authorize import authorize
|
||||||
|
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@ from datetime import datetime, timezone
|
|||||||
from twitchAPI.helper import first
|
from twitchAPI.helper import first
|
||||||
|
|
||||||
from core.broker import broker
|
from core.broker import broker
|
||||||
from repositories.streamers import StreamerConfigRepository
|
from applications.common.repositories.streamers import StreamerConfigRepository
|
||||||
|
|
||||||
from .state import State, UpdateEvent, EventType
|
from .state import State, UpdateEvent, EventType
|
||||||
from .watcher import StateWatcher
|
from .watcher import StateWatcher
|
||||||
@@ -7,11 +7,11 @@ from twitchAPI.twitch import Twitch
|
|||||||
from twitchAPI.object.eventsub import StreamOnlineEvent, ChannelUpdateEvent, ChannelChatMessageEvent, ChannelPointsCustomRewardRedemptionAddEvent
|
from twitchAPI.object.eventsub import StreamOnlineEvent, ChannelUpdateEvent, ChannelChatMessageEvent, ChannelPointsCustomRewardRedemptionAddEvent
|
||||||
from twitchAPI.oauth import validate_token
|
from twitchAPI.oauth import validate_token
|
||||||
|
|
||||||
from repositories.streamers import StreamerConfigRepository, StreamerConfig
|
from applications.common.repositories.streamers import StreamerConfigRepository, StreamerConfig
|
||||||
from modules.stream_notifications.tasks import on_stream_state_change, on_stream_state_change_with_check, on_message, on_redemption_reward_add_task
|
from applications.twitch_webhook.tasks import on_stream_state_change, on_stream_state_change_with_check, on_message, on_redemption_reward_add_task
|
||||||
from modules.stream_notifications.state import UpdateEvent, EventType
|
from applications.twitch_webhook.state import UpdateEvent, EventType
|
||||||
from modules.stream_notifications.messages_proc import MessageEvent
|
from applications.twitch_webhook.messages_proc import MessageEvent
|
||||||
from modules.stream_notifications.reward_redemption import RewardRedemption
|
from applications.twitch_webhook.reward_redemption import RewardRedemption
|
||||||
from .authorize import authorize
|
from .authorize import authorize
|
||||||
|
|
||||||
|
|
||||||
@@ -196,7 +196,3 @@ class TwitchService:
|
|||||||
)
|
)
|
||||||
|
|
||||||
logger.info("Twitch service stopped")
|
logger.info("Twitch service stopped")
|
||||||
|
|
||||||
|
|
||||||
async def start_twitch_service() -> NoReturn:
|
|
||||||
await TwitchService.start()
|
|
||||||
@@ -3,7 +3,7 @@ from datetime import datetime, timezone, timedelta
|
|||||||
from twitchAPI.helper import first
|
from twitchAPI.helper import first
|
||||||
|
|
||||||
from core.redis import redis_manager
|
from core.redis import redis_manager
|
||||||
from repositories.streamers import StreamerConfigRepository
|
from applications.common.repositories.streamers import StreamerConfigRepository
|
||||||
|
|
||||||
from .state import State, StateManager, EventType
|
from .state import State, StateManager, EventType
|
||||||
from .sent_notifications import SentNotificationRepository, SentNotificationType
|
from .sent_notifications import SentNotificationRepository, SentNotificationType
|
||||||
Reference in New Issue
Block a user