100 lines
4.9 KiB
Python
100 lines
4.9 KiB
Python
# -*- coding: utf-8 -*- ############################################################### SOF
|
|
import asyncio
|
|
import os
|
|
import threading
|
|
from time import sleep
|
|
##################################################channel##################################
|
|
import irc3
|
|
from nio import AsyncClient, MatrixRoom, RoomMessageText
|
|
##################################################channel##################################
|
|
from plugins.net_discord_plugin import start_discordbot
|
|
from plugins.net_irc_plugin import config_ircbot, start_ircbot
|
|
from plugins.net_matrix_plugin import start_matrixbot
|
|
from plugins.net_telegram_plugin import start_telegrambot
|
|
from plugins.tool_bus_plugin import BUS
|
|
from plugins.tool_dims_plugin import dims
|
|
from plugins.tool_guds_plugin import guds
|
|
#from plugins.tool_colors_plugin import colorform as print
|
|
##################################################channel##################################
|
|
class BOTIO:
|
|
#######################################################################################
|
|
verbosity=True
|
|
log_exit_level=[]
|
|
loop=asyncio.get_event_loop()
|
|
#######################################################################################
|
|
def __init__(self):
|
|
print(f'<<< ________botio_class >>> [ instantiated ]')
|
|
self.ircbot=config_ircbot()
|
|
self._bio=guds.memory('__main__.bio')
|
|
self.net_irc=[]
|
|
self.net_matrix=[]
|
|
self.net_discord=[]
|
|
self.net_discord_initialized=False
|
|
print(f'<<< ________botio_class >>> [ ircbot configured ]')
|
|
#######################################################################################
|
|
def __boot__irc(self):
|
|
print('<<< system_status__info >>> [ booting connection ] - irc')
|
|
self=start_ircbot(self)
|
|
#######################################################################################
|
|
def __boot__matrix(self):
|
|
print('<<< system_status__info >>> [ booting connection ] - matrix')
|
|
self=start_matrixbot(self)
|
|
#######################################################################################
|
|
def __boot__discord(self):
|
|
print('<<< system_status__info >>> [ booting connection ] - discord')
|
|
self=start_discordbot(self)
|
|
#######################################################################################
|
|
def __boot__telegram(self):
|
|
print('<<< system_status__info >>> [ booting connection ] - telegram')
|
|
self=start_telegrambot(self)
|
|
#######################################################################################
|
|
def __boot__empty(self):
|
|
print('<<< system_status__info >>> [ booting connection ] - empty')
|
|
#######################################################################################
|
|
def __main__(self,index):
|
|
counter=0
|
|
if index==0:
|
|
t=threading.Thread(target=self.__boot__irc)
|
|
print(f'<<< system_status__info >>> [ thread setup ] - irc')
|
|
t.start()
|
|
print(f'<<< system_status__info >>> [ thread started ] - irc')
|
|
elif index==1:
|
|
t=threading.Thread(target=self.__boot__matrix)
|
|
print(f'<<< system_status__info >>> [ thread setup ] - matrix')
|
|
t.start()
|
|
t.join()
|
|
print(f'<<< system_status__info >>> [ thread started ] - matrix')
|
|
elif index==2:
|
|
t=threading.Thread(target=self.__boot__discord)
|
|
print(f'<<< system_status__info >>> [ thread setup ] - discord')
|
|
t.start()
|
|
t.join()
|
|
print(f'<<< system_status__info >>> [ thread started ] - discord')
|
|
elif index==3:
|
|
t=threading.Thread(target=self.__boot__telegram)
|
|
print(f'<<< system_status__info >>> [ thread setup ] - telegram')
|
|
t.start()
|
|
t.join()
|
|
print(f'<<< system_status__info >>> [ thread started ] - telegram')
|
|
elif index==4:
|
|
t=threading.Thread(target=self.__boot__empty)
|
|
print(f'<<< system_status__info >>> [ thread setup ] - empty')
|
|
t.start()
|
|
print(f'<<< system_status__info >>> [ thread started ] - empty')
|
|
###########################################################################################
|
|
if __name__ == '__main__':
|
|
print('<<< system_status__info >>> [ main loop ] - startup')
|
|
bio=BOTIO()
|
|
globals()['guds'].memories.append([bio,'maple:__main__.bio'])
|
|
for i in range(4):
|
|
bio.log_exit_level.append(bio.__main__(i))
|
|
counter=0
|
|
while True:
|
|
counter+=1
|
|
if counter<=3:
|
|
print(f'<<< system_status__info >>> [ eventloop idler thread ] - not ready - system locked for {str(counter).zfill(2)}/3 seconds')
|
|
if counter==4:
|
|
dims.__boot__()
|
|
print(f'<<< system_status__info >>> [ eventloop idler thread ] - system ready')
|
|
sleep(1)
|
|
####################################################################################### EOF |