77 lines
3.4 KiB
Python
77 lines
3.4 KiB
Python
import random
|
|
from enum import Enum, auto
|
|
|
|
from . import AUTHOR_TYPES, Message
|
|
from .ChatProcess import ChatProcess
|
|
|
|
|
|
class CONTROL_MESSAGES(Enum):
|
|
START_STOP = auto()
|
|
|
|
|
|
class STATES(Enum):
|
|
PAUSED = auto()
|
|
RUNNING = auto()
|
|
|
|
|
|
class Process(ChatProcess):
|
|
CHAT_NAME = 'Fake Chat'
|
|
|
|
def __init__(self, *args, max_delay=10, max_messages_per_chunk=1, start_paused=True):
|
|
super().__init__(*args)
|
|
self._max_delay = max_delay
|
|
self._max_messages_per_chunk = max_messages_per_chunk
|
|
self.state = STATES.PAUSED if start_paused else STATES.RUNNING
|
|
|
|
@property
|
|
def keybinds(self):
|
|
return {
|
|
ord('f'): {'type': CONTROL_MESSAGES.START_STOP}
|
|
}
|
|
|
|
def process_messages(self, message_type, args, next_state):
|
|
if message_type == CONTROL_MESSAGES.START_STOP:
|
|
running = not self.state == STATES.RUNNING
|
|
text = 'Fake chat activated!' if running else 'Disabled fake chat'
|
|
|
|
sys_msg = Message(text, Process.CHAT_NAME, self.__class__.__name__, AUTHOR_TYPES.SYSTEM)
|
|
self._message_queue.put(sys_msg)
|
|
|
|
return STATES.RUNNING if running else STATES.PAUSED
|
|
|
|
def loop(self, next_state):
|
|
if self.state == STATES.PAUSED:
|
|
return None
|
|
|
|
while range(int(random.random() * (self._max_messages_per_chunk + 1))):
|
|
author_name, author_id, author_type = random.choice([
|
|
('Random user', '123123', AUTHOR_TYPES.PATRON),
|
|
('Some Guy', '723894', AUTHOR_TYPES.PATRON),
|
|
('xX_ButtSlayerMan1967_Xx', '324234', AUTHOR_TYPES.PATRON),
|
|
('My name is uncessisarily long why does yt allow this', '123786986', AUTHOR_TYPES.PATRON),
|
|
('Taco Bell official (i wish)', '8979823', AUTHOR_TYPES.PATRON),
|
|
('skeh', '1337', AUTHOR_TYPES.OWNER),
|
|
('rando_mod', '6969', AUTHOR_TYPES.MODERATOR),
|
|
])
|
|
text = random.choice([
|
|
'Some fake user saying some shid',
|
|
'Another fake message from a fake fan (lol)',
|
|
'Why play games when you could eat bean',
|
|
'pog more like log',
|
|
'playing the game :drake_dislike:\nspending hours getting the game to run well :drake_like:',
|
|
'now thats what i call epic',
|
|
'POG',
|
|
'oh yeah, thats one neat chat',
|
|
'lmao fake chat',
|
|
'nice chat you got there, be a shame if someone spammed it',
|
|
' i like m y whitespace ',
|
|
'no i \n\n\n like my\nwhite\nspace',
|
|
'this fake user is chatty and say a lot of various things, but its still a coherent sentance somehow',
|
|
'Thanks for coming to my ted talk. Tonight, I discuss what exactly it means to be your little pogchamp, and how "come here" is actually propoganda in disquise. I am very good at parties i swear, please come to my party p l ea se',
|
|
'USRE VERY EXCITE POGGGG POG POGGGGGGGGGGGGGGGGGGGGGGGG POGPOGPOGGGG',
|
|
'spaamamspmapmdpmaspmspsapmspmapsmpasmspmapmpasmspmapmspampsmpaspaspamapmspmapmspmapsmpamspamspmapsmpmaspmapmspamspmapsmpamspmpamspms',
|
|
])
|
|
fake_message = Message(text, author_name, author_id, author_type)
|
|
self._message_queue.put(fake_message)
|
|
|
|
return random.random() * self._max_delay
|