forked from charlesmadere/CynanBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinitCynanBotChatBand.py
880 lines (754 loc) · 38.2 KB
/
initCynanBotChatBand.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
import asyncio
import locale
from asyncio import AbstractEventLoop
from src.beanStats.beanStatsPresenter import BeanStatsPresenter
from src.beanStats.beanStatsPresenterInterface import BeanStatsPresenterInterface
from src.beanStats.beanStatsRepository import BeanStatsRepository
from src.beanStats.beanStatsRepositoryInterface import BeanStatsRepositoryInterface
from src.chatActions.chatActionsManager import ChatActionsManager
from src.chatActions.chatActionsManagerInterface import ChatActionsManagerInterface
from src.chatActions.cheerActionsWizardChatAction import CheerActionsWizardChatAction
from src.chatActions.persistAllUsersChatAction import PersistAllUsersChatAction
from src.chatBand.chatBandInstrumentSoundsRepository import ChatBandInstrumentSoundsRepository
from src.chatBand.chatBandInstrumentSoundsRepositoryInterface import ChatBandInstrumentSoundsRepositoryInterface
from src.chatLogger.chatLogger import ChatLogger
from src.chatLogger.chatLoggerInterface import ChatLoggerInterface
from src.cheerActions.cheerActionHelper import CheerActionHelper
from src.cheerActions.cheerActionHelperInterface import CheerActionHelperInterface
from src.cheerActions.cheerActionJsonMapper import CheerActionJsonMapper
from src.cheerActions.cheerActionJsonMapperInterface import CheerActionJsonMapperInterface
from src.cheerActions.cheerActionSettingsRepository import CheerActionSettingsRepository
from src.cheerActions.cheerActionSettingsRepositoryInterface import CheerActionSettingsRepositoryInterface
from src.cheerActions.cheerActionsRepository import CheerActionsRepository
from src.cheerActions.cheerActionsRepositoryInterface import CheerActionsRepositoryInterface
from src.cheerActions.cheerActionsWizard import CheerActionsWizard
from src.cheerActions.cheerActionsWizardInterface import CheerActionsWizardInterface
from src.cheerActions.soundAlert.soundAlertCheerActionHelper import SoundAlertCheerActionHelper
from src.cheerActions.soundAlert.soundAlertCheerActionHelperInterface import SoundAlertCheerActionHelperInterface
from src.contentScanner.bannedWordsRepository import BannedWordsRepository
from src.contentScanner.bannedWordsRepositoryInterface import BannedWordsRepositoryInterface
from src.contentScanner.contentScanner import ContentScanner
from src.contentScanner.contentScannerInterface import ContentScannerInterface
from src.cynanBot import CynanBot
from src.emojiHelper.emojiHelper import EmojiHelper
from src.emojiHelper.emojiHelperInterface import EmojiHelperInterface
from src.emojiHelper.emojiRepository import EmojiRepository
from src.emojiHelper.emojiRepositoryInterface import EmojiRepositoryInterface
from src.funtoon.funtoonApiService import FuntoonApiService
from src.funtoon.funtoonApiServiceInterface import FuntoonApiServiceInterface
from src.funtoon.funtoonJsonMapper import FuntoonJsonMapper
from src.funtoon.funtoonJsonMapperInterface import FuntoonJsonMapperInterface
from src.funtoon.funtoonRepository import FuntoonRepository
from src.funtoon.funtoonRepositoryInterface import FuntoonRepositoryInterface
from src.funtoon.funtoonTokensRepository import FuntoonTokensRepository
from src.funtoon.funtoonTokensRepositoryInterface import FuntoonTokensRepositoryInterface
from src.funtoon.funtoonUserIdProvider import FuntoonUserIdProvider
from src.funtoon.funtoonUserIdProviderInterface import FuntoonUserIdProviderInterface
from src.google.googleApiAccessTokenStorage import GoogleApiAccessTokenStorage
from src.google.googleApiAccessTokenStorageInterface import GoogleApiAccessTokenStorageInterface
from src.google.googleApiService import GoogleApiService
from src.google.googleApiServiceInterface import GoogleApiServiceInterface
from src.google.googleJsonMapper import GoogleJsonMapper
from src.google.googleJsonMapperInterface import GoogleJsonMapperInterface
from src.google.googleJwtBuilder import GoogleJwtBuilder
from src.google.googleJwtBuilderInterface import GoogleJwtBuilderInterface
from src.language.languagesRepository import LanguagesRepository
from src.language.languagesRepositoryInterface import LanguagesRepositoryInterface
from src.location.locationsRepository import LocationsRepository
from src.location.locationsRepositoryInterface import LocationsRepositoryInterface
from src.location.timeZoneRepository import TimeZoneRepository
from src.location.timeZoneRepositoryInterface import TimeZoneRepositoryInterface
from src.misc.administratorProvider import AdministratorProvider
from src.misc.administratorProviderInterface import AdministratorProviderInterface
from src.misc.authRepository import AuthRepository
from src.misc.backgroundTaskHelper import BackgroundTaskHelper
from src.misc.backgroundTaskHelperInterface import BackgroundTaskHelperInterface
from src.misc.cynanBotUserIdsProvider import CynanBotUserIdsProvider
from src.misc.cynanBotUserIdsProviderInterface import CynanBotUserIdsProviderInterface
from src.misc.generalSettingsRepository import GeneralSettingsRepository
from src.mostRecentChat.mostRecentChatsRepository import MostRecentChatsRepository
from src.mostRecentChat.mostRecentChatsRepositoryInterface import MostRecentChatsRepositoryInterface
from src.network.aioHttp.aioHttpCookieJarProvider import AioHttpCookieJarProvider
from src.network.aioHttpClientProvider import AioHttpClientProvider
from src.network.networkClientProvider import NetworkClientProvider
from src.network.networkClientType import NetworkClientType
from src.network.networkJsonMapper import NetworkJsonMapper
from src.network.networkJsonMapperInterface import NetworkJsonMapperInterface
from src.network.requestsClientProvider import RequestsClientProvider
from src.nightbot.nightbotUserIdProvider import NightbotUserIdProvider
from src.nightbot.nightbotUserIdProviderInterface import NightbotUserIdProviderInterface
from src.puptime.puptimeUserIdProvider import PuptimeUserIdProvider
from src.puptime.puptimeUserIdProviderInterface import PuptimeUserIdProviderInterface
from src.sentMessageLogger.sentMessageLogger import SentMessageLogger
from src.sentMessageLogger.sentMessageLoggerInterface import SentMessageLoggerInterface
from src.seryBot.seryBotUserIdProvider import SeryBotUserIdProvider
from src.seryBot.seryBotUserIdProviderInterface import SeryBotUserIdProviderInterface
from src.soundPlayerManager.immediateSoundPlayerManager import ImmediateSoundPlayerManager
from src.soundPlayerManager.immediateSoundPlayerManagerInterface import ImmediateSoundPlayerManagerInterface
from src.soundPlayerManager.soundAlertJsonMapper import SoundAlertJsonMapper
from src.soundPlayerManager.soundAlertJsonMapperInterface import SoundAlertJsonMapperInterface
from src.soundPlayerManager.soundPlayerManagerProviderInterface import SoundPlayerManagerProviderInterface
from src.soundPlayerManager.soundPlayerRandomizerHelper import SoundPlayerRandomizerHelper
from src.soundPlayerManager.soundPlayerRandomizerHelperInterface import SoundPlayerRandomizerHelperInterface
from src.soundPlayerManager.soundPlayerSettingsRepository import SoundPlayerSettingsRepository
from src.soundPlayerManager.soundPlayerSettingsRepositoryInterface import SoundPlayerSettingsRepositoryInterface
from src.soundPlayerManager.vlc.vlcSoundPlayerManagerProvider import VlcSoundPlayerManagerProvider
from src.storage.backingDatabase import BackingDatabase
from src.storage.backingPsqlDatabase import BackingPsqlDatabase
from src.storage.backingSqliteDatabase import BackingSqliteDatabase
from src.storage.databaseType import DatabaseType
from src.storage.jsonFileReader import JsonFileReader
from src.storage.linesFileReader import LinesFileReader
from src.storage.psqlCredentialsProvider import PsqlCredentialsProvider
from src.storage.psqlCredentialsProviderInterface import PsqlCredentialsProviderInterface
from src.storage.storageJsonMapper import StorageJsonMapper
from src.storage.storageJsonMapperInterface import StorageJsonMapperInterface
from src.streamAlertsManager.streamAlertsManagerInterface import StreamAlertsManagerInterface
from src.streamAlertsManager.stub.stubStreamAlertsManager import StubStreamAlertsManager
from src.streamElements.streamElementsUserIdProvider import StreamElementsUserIdProvider
from src.streamElements.streamElementsUserIdProviderInterface import StreamElementsUserIdProviderInterface
from src.streamLabs.streamLabsUserIdProvider import StreamLabsUserIdProvider
from src.streamLabs.streamLabsUserIdProviderInterface import StreamLabsUserIdProviderInterface
from src.systemCommandHelper.systemCommandHelper import SystemCommandHelper
from src.systemCommandHelper.systemCommandHelperInterface import SystemCommandHelperInterface
from src.tangia.tangiaBotUserIdProvider import TangiaBotUserIdProvider
from src.tangia.tangiaBotUserIdProviderInterface import TangiaBotUserIdProviderInterface
from src.timber.timber import Timber
from src.timber.timberInterface import TimberInterface
from src.tts.ttsJsonMapper import TtsJsonMapper
from src.tts.ttsJsonMapperInterface import TtsJsonMapperInterface
from src.twitch.activeChatters.activeChattersRepository import ActiveChattersRepository
from src.twitch.activeChatters.activeChattersRepositoryInterface import ActiveChattersRepositoryInterface
from src.twitch.api.twitchApiService import TwitchApiService
from src.twitch.api.twitchApiServiceInterface import TwitchApiServiceInterface
from src.twitch.api.twitchJsonMapper import TwitchJsonMapper
from src.twitch.api.twitchJsonMapperInterface import TwitchJsonMapperInterface
from src.twitch.configuration.twitchChannelJoinHelper import TwitchChannelJoinHelper
from src.twitch.configuration.twitchConfiguration import TwitchConfiguration
from src.twitch.configuration.twitchIo.twitchIoConfiguration import TwitchIoConfiguration
from src.twitch.emotes.twitchEmotesHelper import TwitchEmotesHelper
from src.twitch.emotes.twitchEmotesHelperInterface import TwitchEmotesHelperInterface
from src.twitch.followingStatus.twitchFollowingStatusRepository import TwitchFollowingStatusRepository
from src.twitch.followingStatus.twitchFollowingStatusRepositoryInterface import TwitchFollowingStatusRepositoryInterface
from src.twitch.friends.twitchFriendsUserIdRepository import TwitchFriendsUserIdRepository
from src.twitch.friends.twitchFriendsUserIdRepositoryInterface import TwitchFriendsUserIdRepositoryInterface
from src.twitch.isLiveOnTwitchRepository import IsLiveOnTwitchRepository
from src.twitch.isLiveOnTwitchRepositoryInterface import IsLiveOnTwitchRepositoryInterface
from src.twitch.officialTwitchAccountUserIdProvider import OfficialTwitchAccountUserIdProvider
from src.twitch.officialTwitchAccountUserIdProviderInterface import OfficialTwitchAccountUserIdProviderInterface
from src.twitch.timeout.timeoutImmuneUserIdsRepository import TimeoutImmuneUserIdsRepository
from src.twitch.timeout.timeoutImmuneUserIdsRepositoryInterface import TimeoutImmuneUserIdsRepositoryInterface
from src.twitch.timeout.twitchTimeoutHelper import TwitchTimeoutHelper
from src.twitch.timeout.twitchTimeoutHelperInterface import TwitchTimeoutHelperInterface
from src.twitch.timeout.twitchTimeoutRemodHelper import TwitchTimeoutRemodHelper
from src.twitch.timeout.twitchTimeoutRemodHelperInterface import TwitchTimeoutRemodHelperInterface
from src.twitch.timeout.twitchTimeoutRemodRepository import TwitchTimeoutRemodRepository
from src.twitch.timeout.twitchTimeoutRemodRepositoryInterface import TwitchTimeoutRemodRepositoryInterface
from src.twitch.twitchChannelJoinHelperInterface import TwitchChannelJoinHelperInterface
from src.twitch.twitchMessageStringUtils import TwitchMessageStringUtils
from src.twitch.twitchMessageStringUtilsInterface import TwitchMessageStringUtilsInterface
from src.twitch.twitchPredictionWebsocketUtils import TwitchPredictionWebsocketUtils
from src.twitch.twitchPredictionWebsocketUtilsInterface import TwitchPredictionWebsocketUtilsInterface
from src.twitch.twitchTokensRepository import TwitchTokensRepository
from src.twitch.twitchTokensRepositoryInterface import TwitchTokensRepositoryInterface
from src.twitch.twitchTokensUtils import TwitchTokensUtils
from src.twitch.twitchTokensUtilsInterface import TwitchTokensUtilsInterface
from src.twitch.twitchUtils import TwitchUtils
from src.twitch.twitchUtilsInterface import TwitchUtilsInterface
from src.twitch.websocket.twitchWebsocketAllowedUsersRepository import TwitchWebsocketAllowedUsersRepository
from src.twitch.websocket.twitchWebsocketAllowedUsersRepositoryInterface import \
TwitchWebsocketAllowedUsersRepositoryInterface
from src.twitch.websocket.twitchWebsocketClient import TwitchWebsocketClient
from src.twitch.websocket.twitchWebsocketClientInterface import TwitchWebsocketClientInterface
from src.twitch.websocket.twitchWebsocketJsonMapper import TwitchWebsocketJsonMapper
from src.twitch.websocket.twitchWebsocketJsonMapperInterface import TwitchWebsocketJsonMapperInterface
from src.users.addOrRemoveUserDataHelper import AddOrRemoveUserDataHelper
from src.users.addOrRemoveUserDataHelperInterface import AddOrRemoveUserDataHelperInterface
from src.users.crowdControl.crowdControlJsonParser import CrowdControlJsonParser
from src.users.crowdControl.crowdControlJsonParserInterface import CrowdControlJsonParserInterface
from src.users.pkmn.pkmnCatchTypeJsonMapper import PkmnCatchTypeJsonMapper
from src.users.pkmn.pkmnCatchTypeJsonMapperInterface import PkmnCatchTypeJsonMapperInterface
from src.users.timeout.timeoutBoosterPackJsonParser import TimeoutBoosterPackJsonParser
from src.users.timeout.timeoutBoosterPackJsonParserInterface import TimeoutBoosterPackJsonParserInterface
from src.users.tts.stub.stubTtsBoosterPackParser import StubTtsBoosterPackParser
from src.users.tts.stub.stubTtsChatterBoosterPackParser import StubTtsChatterBoosterPackParser
from src.users.tts.ttsBoosterPackParserInterface import TtsBoosterPackParserInterface
from src.users.ttsChatters.ttsChatterBoosterPackParserInterface import TtsChatterBoosterPackParserInterface
from src.users.userIdsRepository import UserIdsRepository
from src.users.userIdsRepositoryInterface import UserIdsRepositoryInterface
from src.users.usersRepository import UsersRepository
from src.users.usersRepositoryInterface import UsersRepositoryInterface
from src.websocketConnection.websocketConnectionServer import WebsocketConnectionServer
from src.websocketConnection.websocketConnectionServerInterface import WebsocketConnectionServerInterface
# Uncomment this chunk to turn on extra extra debug logging
# logging.basicConfig(
# filename = 'generalLogging.log',
# level = logging.DEBUG
# )
locale.setlocale(locale.LC_ALL, 'en_US.utf8')
#################################
## Core initialization section ##
#################################
eventLoop: AbstractEventLoop = asyncio.new_event_loop()
asyncio.set_event_loop(eventLoop)
backgroundTaskHelper: BackgroundTaskHelperInterface = BackgroundTaskHelper(
eventLoop = eventLoop
)
timeZoneRepository: TimeZoneRepositoryInterface = TimeZoneRepository()
timber: TimberInterface = Timber(
backgroundTaskHelper = backgroundTaskHelper,
timeZoneRepository = timeZoneRepository
)
networkJsonMapper: NetworkJsonMapperInterface = NetworkJsonMapper()
storageJsonMapper: StorageJsonMapperInterface = StorageJsonMapper()
generalSettingsRepository = GeneralSettingsRepository(
settingsJsonReader = JsonFileReader('generalSettingsRepository.json'),
networkJsonMapper = networkJsonMapper,
storageJsonMapper = storageJsonMapper
)
generalSettingsSnapshot = generalSettingsRepository.getAll()
backingDatabase: BackingDatabase
psqlCredentialsProvider: PsqlCredentialsProviderInterface | None = None
match generalSettingsSnapshot.requireDatabaseType():
case DatabaseType.POSTGRESQL:
psqlCredentialsProvider = PsqlCredentialsProvider(
credentialsJsonReader = JsonFileReader('psqlCredentials.json')
)
backingDatabase = BackingPsqlDatabase(
eventLoop = eventLoop,
psqlCredentialsProvider = psqlCredentialsProvider,
timber = timber
)
case DatabaseType.SQLITE:
backingDatabase = BackingSqliteDatabase(
eventLoop = eventLoop
)
case _:
raise RuntimeError(f'Unknown/misconfigured DatabaseType: \"{generalSettingsSnapshot.requireDatabaseType()}\"')
networkClientProvider: NetworkClientProvider
match generalSettingsSnapshot.requireNetworkClientType():
case NetworkClientType.AIOHTTP:
aioHttpCookieJarProvider = AioHttpCookieJarProvider(
eventLoop = eventLoop
)
networkClientProvider = AioHttpClientProvider(
eventLoop = eventLoop,
cookieJarProvider = aioHttpCookieJarProvider,
timber = timber
)
case NetworkClientType.REQUESTS:
networkClientProvider = RequestsClientProvider(
timber = timber
)
case _:
raise RuntimeError(f'Unknown/misconfigured NetworkClientType: \"{generalSettingsSnapshot.requireNetworkClientType()}\"')
authRepository = AuthRepository(
authJsonReader = JsonFileReader('authRepository.json')
)
twitchJsonMapper: TwitchJsonMapperInterface = TwitchJsonMapper(
timber = timber,
timeZoneRepository = timeZoneRepository
)
twitchWebsocketJsonMapper: TwitchWebsocketJsonMapperInterface = TwitchWebsocketJsonMapper(
timber = timber,
twitchJsonMapper = twitchJsonMapper
)
twitchApiService: TwitchApiServiceInterface = TwitchApiService(
networkClientProvider = networkClientProvider,
timber = timber,
timeZoneRepository = timeZoneRepository,
twitchCredentialsProvider = authRepository,
twitchJsonMapper = twitchJsonMapper,
twitchWebsocketJsonMapper = twitchWebsocketJsonMapper,
)
officialTwitchAccountUserIdProvider: OfficialTwitchAccountUserIdProviderInterface = OfficialTwitchAccountUserIdProvider()
userIdsRepository: UserIdsRepositoryInterface = UserIdsRepository(
backingDatabase = backingDatabase,
officialTwitchAccountUserIdProvider = officialTwitchAccountUserIdProvider,
timber = timber,
twitchApiService = twitchApiService
)
twitchTokensRepository: TwitchTokensRepositoryInterface = TwitchTokensRepository(
backgroundTaskHelper = backgroundTaskHelper,
backingDatabase = backingDatabase,
timber = timber,
timeZoneRepository = timeZoneRepository,
twitchApiService = twitchApiService,
userIdsRepository = userIdsRepository,
seedFileReader = JsonFileReader('twitchTokensRepositorySeedFile.json')
)
administratorProvider: AdministratorProviderInterface = AdministratorProvider(
generalSettingsRepository = generalSettingsRepository,
twitchTokensRepository = twitchTokensRepository,
userIdsRepository = userIdsRepository
)
websocketConnectionServer: WebsocketConnectionServerInterface = WebsocketConnectionServer(
backgroundTaskHelper = backgroundTaskHelper,
settingsJsonReader = JsonFileReader('websocketConnectionServer.json'),
timber = timber,
timeZoneRepository = timeZoneRepository,
)
bannedWordsRepository: BannedWordsRepositoryInterface = BannedWordsRepository(
bannedWordsLinesReader = LinesFileReader('bannedWords.txt'),
timber = timber
)
contentScanner: ContentScannerInterface = ContentScanner(
bannedWordsRepository = bannedWordsRepository,
timber = timber
)
twitchTokensUtils: TwitchTokensUtilsInterface = TwitchTokensUtils(
administratorProvider = administratorProvider,
twitchTokensRepository = twitchTokensRepository
)
twitchEmotesHelper: TwitchEmotesHelperInterface = TwitchEmotesHelper(
timber = timber,
twitchApiService = twitchApiService,
twitchHandleProvider = authRepository,
twitchTokensRepository = twitchTokensRepository,
userIdsRepository = userIdsRepository
)
twitchFollowingStatusRepository: TwitchFollowingStatusRepositoryInterface = TwitchFollowingStatusRepository(
backingDatabase = backingDatabase,
timber = timber,
twitchApiService = twitchApiService,
userIdsRepository = userIdsRepository
)
crowdControlJsonParser: CrowdControlJsonParserInterface = CrowdControlJsonParser()
pkmnCatchTypeJsonMapper: PkmnCatchTypeJsonMapperInterface = PkmnCatchTypeJsonMapper(
timber = timber
)
soundAlertJsonMapper: SoundAlertJsonMapperInterface = SoundAlertJsonMapper(
timber = timber
)
timeoutBoosterPackJsonParser: TimeoutBoosterPackJsonParserInterface = TimeoutBoosterPackJsonParser()
ttsJsonMapper: TtsJsonMapperInterface = TtsJsonMapper(
timber = timber
)
ttsBoosterPackParser: TtsBoosterPackParserInterface = StubTtsBoosterPackParser()
ttsChatterBoosterPackParser: TtsChatterBoosterPackParserInterface = StubTtsChatterBoosterPackParser()
usersRepository: UsersRepositoryInterface = UsersRepository(
crowdControlJsonParser = crowdControlJsonParser,
pkmnCatchTypeJsonMapper = pkmnCatchTypeJsonMapper,
soundAlertJsonMapper = soundAlertJsonMapper,
timber = timber,
timeoutBoosterPackJsonParser = timeoutBoosterPackJsonParser,
timeZoneRepository = timeZoneRepository,
ttsBoosterPackParser = ttsBoosterPackParser,
ttsChatterBoosterPackParser = ttsChatterBoosterPackParser,
ttsJsonMapper = ttsJsonMapper
)
twitchChannelJoinHelper: TwitchChannelJoinHelperInterface = TwitchChannelJoinHelper(
backgroundTaskHelper = backgroundTaskHelper,
verified = True,
timber = timber,
usersRepository = usersRepository
)
twitchPredictionWebsocketUtils: TwitchPredictionWebsocketUtilsInterface = TwitchPredictionWebsocketUtils()
addOrRemoveUserDataHelper: AddOrRemoveUserDataHelperInterface = AddOrRemoveUserDataHelper(
timber = timber,
timeZoneRepository = timeZoneRepository
)
chatLogger: ChatLoggerInterface = ChatLogger(
backgroundTaskHelper = backgroundTaskHelper,
timber = timber,
timeZoneRepository = timeZoneRepository
)
#####################################
## CynanBot initialization section ##
#####################################
cynanBotUserIdsProvider: CynanBotUserIdsProviderInterface = CynanBotUserIdsProvider()
twitchFriendsUserIdRepository: TwitchFriendsUserIdRepositoryInterface = TwitchFriendsUserIdRepository()
#####################################
## Nightbot initialization section ##
#####################################
nightbotUserIdProvider: NightbotUserIdProviderInterface = NightbotUserIdProvider()
###################################
## Tangia initialization section ##
###################################
tangiaBotUserIdProvider: TangiaBotUserIdProviderInterface = TangiaBotUserIdProvider()
####################################
## Funtoon initialization section ##
####################################
funtoonUserIdProvider: FuntoonUserIdProviderInterface = FuntoonUserIdProvider()
funtoonTokensRepository: FuntoonTokensRepositoryInterface = FuntoonTokensRepository(
backingDatabase = backingDatabase,
timber = timber,
userIdsRepository = userIdsRepository,
seedFileReader = JsonFileReader('funtoonTokensRepositorySeedFile.json')
)
funtoonJsonMapper: FuntoonJsonMapperInterface = FuntoonJsonMapper()
funtoonApiService: FuntoonApiServiceInterface = FuntoonApiService(
funtoonJsonMapper = funtoonJsonMapper,
networkClientProvider = networkClientProvider,
timber = timber
)
funtoonRepository: FuntoonRepositoryInterface = FuntoonRepository(
funtoonApiService = funtoonApiService,
funtoonJsonMapper = funtoonJsonMapper,
funtoonTokensRepository = funtoonTokensRepository,
timber = timber
)
emojiRepository: EmojiRepositoryInterface = EmojiRepository(
emojiJsonReader = JsonFileReader('emojiRepository.json'),
timber = timber
)
emojiHelper: EmojiHelperInterface = EmojiHelper(
emojiRepository = emojiRepository
)
isLiveOnTwitchRepository: IsLiveOnTwitchRepositoryInterface = IsLiveOnTwitchRepository(
administratorProvider = administratorProvider,
timber = timber,
twitchApiService = twitchApiService,
twitchTokensRepository = twitchTokensRepository
)
languagesRepository: LanguagesRepositoryInterface = LanguagesRepository()
locationsRepository: LocationsRepositoryInterface = LocationsRepository(
locationsJsonReader = JsonFileReader('locationsRepository.json'),
timber = timber,
timeZoneRepository = timeZoneRepository
)
mostRecentChatsRepository: MostRecentChatsRepositoryInterface = MostRecentChatsRepository(
backingDatabase = backingDatabase,
timber = timber,
timeZoneRepository = timeZoneRepository
)
systemCommandHelper: SystemCommandHelperInterface = SystemCommandHelper(
timber = timber
)
twitchConfiguration: TwitchConfiguration = TwitchIoConfiguration(
userIdsRepository = userIdsRepository
)
sentMessageLogger: SentMessageLoggerInterface = SentMessageLogger(
backgroundTaskHelper = backgroundTaskHelper,
timber = timber,
timeZoneRepository = timeZoneRepository
)
twitchTimeoutRemodRepository: TwitchTimeoutRemodRepositoryInterface = TwitchTimeoutRemodRepository(
backingDatabase = backingDatabase,
timber = timber,
timeZoneRepository = timeZoneRepository
)
twitchTimeoutRemodHelper: TwitchTimeoutRemodHelperInterface = TwitchTimeoutRemodHelper(
backgroundTaskHelper = backgroundTaskHelper,
timber = timber,
timeZoneRepository = timeZoneRepository,
twitchApiService = twitchApiService,
twitchTimeoutRemodRepository = twitchTimeoutRemodRepository,
twitchTokensRepository = twitchTokensRepository,
userIdsRepository = userIdsRepository
)
twitchMessageStringUtils: TwitchMessageStringUtilsInterface = TwitchMessageStringUtils()
twitchUtils: TwitchUtilsInterface = TwitchUtils(
backgroundTaskHelper = backgroundTaskHelper,
generalSettingsRepository = generalSettingsRepository,
sentMessageLogger = sentMessageLogger,
timber = timber,
timeZoneRepository = timeZoneRepository,
twitchApiService = twitchApiService,
twitchHandleProvider = authRepository,
twitchTokensRepository = twitchTokensRepository,
userIdsRepository = userIdsRepository
)
puptimeUserIdProvider: PuptimeUserIdProviderInterface = PuptimeUserIdProvider()
seryBotUserIdProvider: SeryBotUserIdProviderInterface = SeryBotUserIdProvider()
streamElementsUserIdProvider: StreamElementsUserIdProviderInterface = StreamElementsUserIdProvider()
streamLabsUserIdProvider: StreamLabsUserIdProviderInterface = StreamLabsUserIdProvider()
timeoutImmuneUserIdsRepository: TimeoutImmuneUserIdsRepositoryInterface = TimeoutImmuneUserIdsRepository(
cynanBotUserIdsProvider = cynanBotUserIdsProvider,
funtoonUserIdProvider = funtoonUserIdProvider,
nightbotUserIdProvider = nightbotUserIdProvider,
officialTwitchAccountUserIdProvider = officialTwitchAccountUserIdProvider,
puptimeUserIdProvider = puptimeUserIdProvider,
seryBotUserIdProvider = seryBotUserIdProvider,
streamElementsUserIdProvider = streamElementsUserIdProvider,
streamLabsUserIdProvider = streamLabsUserIdProvider,
tangiaBotUserIdProvider = tangiaBotUserIdProvider,
twitchFriendsUserIdProvider = twitchFriendsUserIdRepository,
twitchHandleProvider = authRepository,
userIdsRepository = userIdsRepository
)
twitchTimeoutHelper: TwitchTimeoutHelperInterface = TwitchTimeoutHelper(
timber = timber,
timeoutImmuneUserIdsRepository = timeoutImmuneUserIdsRepository,
twitchApiService = twitchApiService,
twitchConstants = twitchUtils,
twitchHandleProvider = authRepository,
twitchTimeoutRemodHelper = twitchTimeoutRemodHelper,
userIdsRepository = userIdsRepository
)
googleApiAccessTokenStorage: GoogleApiAccessTokenStorageInterface = GoogleApiAccessTokenStorage(
timber = timber,
timeZoneRepository = timeZoneRepository,
)
googleJsonMapper: GoogleJsonMapperInterface = GoogleJsonMapper(
timber = timber,
timeZoneRepository = timeZoneRepository,
)
googleJwtBuilder: GoogleJwtBuilderInterface = GoogleJwtBuilder(
googleCloudCredentialsProvider = authRepository,
googleJsonMapper = googleJsonMapper,
timeZoneRepository = timeZoneRepository,
)
googleApiService: GoogleApiServiceInterface = GoogleApiService(
googleApiAccessTokenStorage = googleApiAccessTokenStorage,
googleCloudProjectCredentialsProvider = authRepository,
googleJsonMapper = googleJsonMapper,
googleJwtBuilder = googleJwtBuilder,
networkClientProvider = networkClientProvider,
timber = timber
)
twitchWebsocketAllowedUsersRepository: TwitchWebsocketAllowedUsersRepositoryInterface = TwitchWebsocketAllowedUsersRepository(
timber = timber,
twitchTokensRepository = twitchTokensRepository,
userIdsRepository = userIdsRepository,
usersRepository = usersRepository
)
twitchWebsocketClient: TwitchWebsocketClientInterface | None = None
if generalSettingsSnapshot.isEventSubEnabled():
twitchWebsocketClient = TwitchWebsocketClient(
backgroundTaskHelper = backgroundTaskHelper,
timber = timber,
timeZoneRepository = timeZoneRepository,
twitchApiService = twitchApiService,
twitchTokensRepository = twitchTokensRepository,
twitchWebsocketAllowedUsersRepository = twitchWebsocketAllowedUsersRepository,
twitchWebsocketJsonMapper = twitchWebsocketJsonMapper
)
#################################
## Bean initialization section ##
#################################
beanStatsPresenter: BeanStatsPresenterInterface = BeanStatsPresenter()
beanStatsRepository: BeanStatsRepositoryInterface = BeanStatsRepository(
backingDatabase = backingDatabase,
timber = timber,
timeZoneRepository = timeZoneRepository,
userIdsRepository = userIdsRepository
)
######################################
## Chat Band initialization section ##
######################################
chatBandInstrumentSoundsRepository: ChatBandInstrumentSoundsRepositoryInterface = ChatBandInstrumentSoundsRepository(
backgroundTaskHelper = backgroundTaskHelper,
timber = timber
)
#########################################
## Sound Player initialization section ##
#########################################
soundPlayerSettingsRepository: SoundPlayerSettingsRepositoryInterface = SoundPlayerSettingsRepository(
settingsJsonReader = JsonFileReader('soundPlayerSettingsRepository.json')
)
soundPlayerRandomizerHelper: SoundPlayerRandomizerHelperInterface | None = SoundPlayerRandomizerHelper(
backgroundTaskHelper = backgroundTaskHelper,
soundPlayerSettingsRepository = soundPlayerSettingsRepository,
timber = timber
)
soundPlayerManagerProvider: SoundPlayerManagerProviderInterface = VlcSoundPlayerManagerProvider(
backgroundTaskHelper = backgroundTaskHelper,
chatBandInstrumentSoundsRepository = chatBandInstrumentSoundsRepository,
soundPlayerSettingsRepository = soundPlayerSettingsRepository,
timber = timber
)
immediateSoundPlayerManager: ImmediateSoundPlayerManagerInterface = ImmediateSoundPlayerManager(
soundPlayerManagerProvider = soundPlayerManagerProvider
)
##################################################
## Stream Alerts Manager initialization section ##
##################################################
streamAlertsManager: StreamAlertsManagerInterface = StubStreamAlertsManager()
##########################################
## Cheer Actions initialization section ##
##########################################
cheerActionJsonMapper: CheerActionJsonMapperInterface = CheerActionJsonMapper(
timber = timber
)
cheerActionSettingsRepository: CheerActionSettingsRepositoryInterface = CheerActionSettingsRepository(
settingsJsonReader = JsonFileReader('cheerActionSettings.json')
)
cheerActionsRepository: CheerActionsRepositoryInterface = CheerActionsRepository(
backingDatabase = backingDatabase,
cheerActionJsonMapper = cheerActionJsonMapper,
cheerActionSettingsRepository = cheerActionSettingsRepository,
timber = timber
)
soundAlertCheerActionHelper: SoundAlertCheerActionHelperInterface | None = SoundAlertCheerActionHelper(
immediateSoundPlayerManager = immediateSoundPlayerManager,
isLiveOnTwitchRepository = isLiveOnTwitchRepository,
soundPlayerRandomizerHelper = soundPlayerRandomizerHelper,
timber = timber
)
cheerActionHelper: CheerActionHelperInterface = CheerActionHelper(
beanChanceCheerActionHelper = None,
cheerActionsRepository = cheerActionsRepository,
crowdControlCheerActionHelper = None,
soundAlertCheerActionHelper = soundAlertCheerActionHelper,
timeoutCheerActionHelper = None,
twitchHandleProvider = authRepository,
twitchTokensRepository = twitchTokensRepository,
userIdsRepository = userIdsRepository
)
#########################################
## Chat Actions initialization section ##
#########################################
activeChattersRepository: ActiveChattersRepositoryInterface = ActiveChattersRepository(
timeZoneRepository = timeZoneRepository
)
cheerActionsWizard: CheerActionsWizardInterface = CheerActionsWizard(
timber = timber
)
cheerActionsWizardChatAction = CheerActionsWizardChatAction(
cheerActionJsonMapper = cheerActionJsonMapper,
cheerActionsRepository = cheerActionsRepository,
cheerActionsWizard = cheerActionsWizard,
timber = timber,
twitchUtils = twitchUtils
)
persistAllUsersChatAction = PersistAllUsersChatAction(
generalSettingsRepository = generalSettingsRepository,
userIdsRepository = userIdsRepository
)
chatActionsManager: ChatActionsManagerInterface = ChatActionsManager(
activeChattersRepository = activeChattersRepository,
anivCheckChatAction = None,
catJamChatAction = None,
chatLoggerChatAction = None,
cheerActionsWizardChatAction = cheerActionsWizardChatAction,
deerForceChatAction = None,
generalSettingsRepository = generalSettingsRepository,
mostRecentAnivMessageTimeoutHelper = None,
mostRecentChatsRepository = mostRecentChatsRepository,
persistAllUsersChatAction = persistAllUsersChatAction,
recurringActionsWizardChatAction = None,
saveMostRecentAnivMessageChatAction = None,
schubertWalkChatAction = None,
supStreamerChatAction = None,
timber = timber,
ttsChattersChatAction = None,
twitchUtils = twitchUtils,
userIdsRepository = userIdsRepository,
usersRepository = usersRepository
)
#####################################
## CynanBot initialization section ##
#####################################
cynanBot = CynanBot(
eventLoop = eventLoop,
twitchCheerHandler = None,
twitchFollowHandler = None,
twitchPollHandler = None,
twitchPredictionHandler = None,
twitchRaidHandler = None,
twitchSubscriptionHandler = None,
additionalTriviaAnswersRepository = None,
addOrRemoveUserDataHelper = addOrRemoveUserDataHelper,
administratorProvider = administratorProvider,
anivCopyMessageTimeoutScorePresenter = None,
anivCopyMessageTimeoutScoreRepository = None,
anivSettingsRepository = None,
authRepository = authRepository,
backgroundTaskHelper = backgroundTaskHelper,
bannedTriviaGameControllersRepository = None,
bannedWordsRepository = None,
beanChanceCheerActionHelper = None,
beanStatsPresenter = None,
beanStatsRepository = None,
bizhawkSettingsRepository = None,
chatActionsManager = chatActionsManager,
chatLogger = chatLogger,
cheerActionHelper = None,
cheerActionJsonMapper = None,
cheerActionSettingsRepository = None,
cheerActionsRepository = None,
cheerActionsWizard = None,
crowdControlActionHandler = None,
crowdControlIdGenerator = None,
crowdControlMachine = None,
crowdControlMessageHandler = None,
crowdControlSettingsRepository = None,
crowdControlUserInputUtils = None,
cutenessPresenter = None,
cutenessRepository = None,
cutenessUtils = None,
funtoonRepository = None,
funtoonTokensRepository = None,
generalSettingsRepository = generalSettingsRepository,
immediateSoundPlayerManager = immediateSoundPlayerManager,
isLiveOnTwitchRepository = isLiveOnTwitchRepository,
jishoHelper = None,
languagesRepository = languagesRepository,
locationsRepository = locationsRepository,
mostRecentAnivMessageRepository = None,
mostRecentAnivMessageTimeoutHelper = None,
mostRecentChatsRepository = mostRecentChatsRepository,
openTriviaDatabaseSessionTokenRepository = None,
pokepediaRepository = None,
psqlCredentialsProvider = psqlCredentialsProvider,
recurringActionsHelper = None,
recurringActionsMachine = None,
recurringActionsRepository = None,
recurringActionsWizard = None,
sentMessageLogger = sentMessageLogger,
shinyTriviaOccurencesRepository = None,
soundPlayerRandomizerHelper = soundPlayerRandomizerHelper,
soundPlayerSettingsRepository = soundPlayerSettingsRepository,
starWarsQuotesRepository = None,
streamAlertsManager = streamAlertsManager,
streamAlertsSettingsRepository = None,
streamElementsSettingsRepository = None,
streamElementsUserKeyRepository = None,
supStreamerRepository = None,
timber = timber,
timeoutActionHelper = None,
timeoutActionHistoryRepository = None,
timeoutActionSettingsRepository = None,
timeZoneRepository = timeZoneRepository,
toxicTriviaOccurencesRepository = None,
translationHelper = None,
triviaBanHelper = None,
triviaEmoteGenerator = None,
triviaGameBuilder = None,
triviaGameControllersRepository = None,
triviaGameGlobalControllersRepository = None,
triviaGameMachine = None,
triviaHistoryRepository = None,
triviaIdGenerator = None,
triviaRepository = None,
triviaScoreRepository = None,
triviaSettingsRepository = None,
triviaTwitchEmoteHelper = None,
triviaUtils = None,
trollmojiHelper = None,
trollmojiSettingsRepository = None,
ttsJsonMapper = None,
ttsMonsterApiTokensRepository = None,
ttsMonsterKeyAndUserIdRepository = None,
ttsMonsterManager = None,
ttsMonsterSettingsRepository = None,
ttsMonsterStreamerVoicesRepository = None,
ttsSettingsRepository = None,
twitchApiService = twitchApiService,
twitchChannelJoinHelper = twitchChannelJoinHelper,
twitchConfiguration = twitchConfiguration,
twitchEmotesHelper = twitchEmotesHelper,
twitchFollowingStatusRepository = None,
twitchFriendsUserIdRepository = twitchFriendsUserIdRepository,
twitchMessageStringUtils = twitchMessageStringUtils,
twitchPredictionWebsocketUtils = None,
twitchTimeoutHelper = twitchTimeoutHelper,
twitchTimeoutRemodHelper = twitchTimeoutRemodHelper,
twitchTokensRepository = twitchTokensRepository,
twitchTokensUtils = twitchTokensUtils,
twitchUtils = twitchUtils,
twitchWebsocketClient = twitchWebsocketClient,
userIdsRepository = userIdsRepository,
usersRepository = usersRepository,
weatherReportPresenter = None,
weatherRepository = None,
websocketConnectionServer = None,
wordOfTheDayPresenter = None,
wordOfTheDayRepository = None
)
#########################################
## Section for starting the actual bot ##
#########################################
timber.log('initCynanBot', 'Starting CynanBot...')
cynanBot.run()