Initial Release of IGNCore version 2.5

This commit is contained in:
2021-08-09 13:18:56 +02:00
commit a83d98c47e
910 changed files with 224171 additions and 0 deletions
+78
View File
@@ -0,0 +1,78 @@
# noinspection DuplicatedCode
from core.dict_object import DictObject
# Copy this file to ./conf/##bot_name##.py,
# template.config.py provides a copy without any comments,
# for easier and faster editing.
# and change the settings provided below.
# This file is used for Code Completion or Type Hinting. DO NOT DELETE IT.
# This file is used for Code Completion or Type Hinting. DO NOT DELETE IT.
class BotConfig:
username = ""
password = ""
character = ""
# This should be a list of CharID's. For some Reason I didnt like the idea of sticking to Names...
# Dont ask me why :P
superadmin = []
# Only MariaDB is supported, please supply the details used for the bot data.
database = DictObject({
"type": "mariadb",
"username": "",
"password": "",
"host": "",
"name": ""})
# IGNCore supports splitting of the DB; If you're hosting multiple bots, its generally a good idea to fill
# this section with additional details. every mariadb user used by bots (e.g. the one above)
# will need update, delete and insert permissions in this database.
#
# If you only host one bot, and because of that dont need to split the database,
# please remove this section entirely.
# START #
shared_db = DictObject({
"type": "mariadb",
"username": "",
"password": "",
"host": "",
"name": ""
})
# END #
# If you have got access to any sort of tower API (there are multiple)
# you can enter the URI for accessing it here.
tower_url = ""
# In this section you can add some slaves to the bot.
# They serve as a buddylist expander, and tells may get sent through them. (Tells which are known to be spammy)
slaves = [
# {"username": "account_name", "password": "password", "character": "character_name"},
]
# You will need to edit this section, if you're hosting a bot for RK6, or any other server than RK5.
server = DictObject({
"dimension": "5",
"host": "chat.d1.funcom.com",
"port": 7105
})
# Here the module paths are configured.
#
# Supported paths:
# modules/core - Contains the core modules. They provide commands which are necessary to run the bot.
# modules/onlinebot - Contains modules useful for bots running between multiple orgs; for example, Alliances.
# modules/orgbot - Provides modules specifically for org bots.
# modules/raidbot - Provides Raidbot functionality. For example Massinvites, Masstells, Tower stuff, and Raids.
# modules/standard - Here are modules useful in all bot types; For Example loot tables, item database, and so on.
module_paths = [
"modules/core",
"modules/standard",
"modules/raidbot"
]
# DO NOT TOUCH THIS LINE
slaves = [DictObject(x) for x in slaves if password != ""]
+65
View File
@@ -0,0 +1,65 @@
import logging
import logging.config
import logging.handlers
import os
import sys
import time
from datetime import datetime
class FilterInfo:
def filter(self, rec):
return rec.levelno <= logging.INFO
formatter = logging.Formatter('[%(asctime)s] %(levelname)s :: %(name)s -> %(message)s', datefmt="%d.%m.%Y %H:%M:%S")
name = "bot"
# As the core is able to host multiple bots out of the same directory, filtering the logs only sounds reasonable.
# So we're saving the logs into ./logs/##bot_name##/
if len(sys.argv) > 1:
name = sys.argv[1]
try:
os.mkdir(f"./logs/{name}")
except FileExistsError as error:
pass
# Rotate logs at 0 a.m. on Monday, GMT-0
file_handler = logging.handlers.TimedRotatingFileHandler(f"./logs/{name}/bot.log",
when='W6', utc=True,
backupCount=1000, encoding="utf-8")
file_handler.setFormatter(formatter)
# Fix time display => UTC-0
logging.Formatter.converter = lambda *args: datetime.utcnow().timetuple()
console_out = logging.StreamHandler(sys.stdout)
console_out.setFormatter(formatter)
# noinspection PyTypeChecker
console_out.addFilter(FilterInfo())
console_err = logging.StreamHandler(sys.stderr)
console_err.setFormatter(formatter)
console_err.setLevel(logging.WARN)
logging.root.setLevel(logging.INFO)
logging.root.addHandler(file_handler)
logging.root.addHandler(console_out)
logging.root.addHandler(console_err)
current_time = int(time.time())
# noinspection PyUnresolvedReferences
rollover_time = file_handler.computeRollover(current_time)
logging.info("Next log rollover has been scheduled for " + str(datetime.utcfromtimestamp(rollover_time)))
# reduce discord spam
# logging.getLogger("websockets").setLevel(logging.INFO)
# logging.getlogger("discord").setLevel(logging.INFO)
# Supress Spam generated by using TOR
# [used in: character_history_service.py & tower_service.py
logging.getLogger("torpy.stream").setLevel(logging.WARN)
logging.getLogger("torpy.guard").setLevel(logging.WARN)
logging.getLogger("torpy.consesus").setLevel(logging.WARN)
logging.getLogger("torpy.circuit").setLevel(logging.WARN)
logging.getLogger("torpy.cache_storage").setLevel(logging.WARN)
logging.getLogger("torpy.documents.network_status").setLevel(logging.WARN)
+42
View File
@@ -0,0 +1,42 @@
from core.dict_object import DictObject
class BotConfig:
username = ""
password = ""
character = ""
superadmin = []
database = DictObject({
"type": "mariadb",
"username": "",
"password": "",
"host": "",
"name": ""})
shared_db = DictObject({
"type": "mariadb",
"username": "",
"password": "",
"host": "",
"name": ""
})
tower_url = ""
slaves = [
# {"username": "account_name", "password": "password", "character": "character_name"},
]
server = DictObject({
"dimension": "5",
"host": "chat.d1.funcom.com",
"port": 7105
})
module_paths = [
"modules/core",
"modules/standard",
"modules/raidbot"
]
slaves = [DictObject(x) for x in slaves if password != ""]