fix
This commit is contained in:
@@ -3,6 +3,7 @@ IRC сервис для мониторинга Twitch чата.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import random
|
||||
import re
|
||||
import logging
|
||||
from typing import Optional, Callable, Awaitable, List
|
||||
@@ -28,7 +29,13 @@ class TwitchIRCClient:
|
||||
):
|
||||
self.channel = channel.lower()
|
||||
self.target_username = target_username.lower()
|
||||
self.irc_username = irc_username or settings.IRC_USERNAME
|
||||
# Anonymous Twitch login (justinfanNNNNN) is shared across all clients by
|
||||
# default, so parallel monitors on the same nick get kicked by Twitch
|
||||
# (one connection per nick) — randomize it unless a real login is configured.
|
||||
if irc_username or settings.IRC_USERNAME != "justinfan12345":
|
||||
self.irc_username = irc_username or settings.IRC_USERNAME
|
||||
else:
|
||||
self.irc_username = f"justinfan{random.randint(10000, 99999)}"
|
||||
self.irc_oauth = irc_oauth or settings.IRC_OAUTH
|
||||
|
||||
self._reader: Optional[asyncio.StreamReader] = None
|
||||
|
||||
Reference in New Issue
Block a user