Implement more automated provisioning of aliases and relays, and remove networks cleanly

This commit is contained in:
2019-10-02 20:26:05 +01:00
parent 0f31d7f5e2
commit a3b81f8849
6 changed files with 77 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
from twisted.internet.ssl import DefaultOpenSSLContextFactory
import json
import modules.alias as alias
from modules import alias
from twisted.internet import reactor
from core.bot import IRCBot, IRCBotFactory
import main
@@ -43,6 +43,19 @@ class Network:
del self.aliases[id]
#del main.alias[id] - Aliases are global per num, so don't delete them!
def seppuku(self):
# Removes all bots in preperation for deletion
for i in self.relays.keys():
name = self.net+str(i)
if name in main.ReactorPool.keys():
if name in main.FactoryPool.keys():
main.FactoryPool[name].stopTrying()
main.ReactorPool[name].disconnect()
if name in main.IRCPool.keys():
del main.IRCPool[name]
del main.ReactorPool[name]
del main.FactoryPool[name]
def start_bot(self, num):
# a single name is given to relays in the backend
# e.g. freenode1 for the first relay on freenode network