Release 0.3

Signed-off-by: Marc Ahlgrim <marc@onemarcfifty.com>
This commit is contained in:
Marc Ahlgrim
2022-07-22 12:50:06 +02:00
parent e58ba3a745
commit 6e35d9e064
15 changed files with 497 additions and 173 deletions
+62 -38
View File
@@ -1,57 +1,81 @@
import json
# Config data is stored in config.json
# see the config.json.example file and below comments
# readConfig() reads the file
cfg = None
AUTO_EVENTS = []
SECRETS = {}
CONFIG = {}
def readConfig():
try:
f = open('config.json')
global cfg
cfg = json.load(f)
#configData = json.loads(data)
f.close()
global AUTO_EVENTS
AUTO_EVENTS = cfg["AUTO_EVENTS"]
global CONFIG
CONFIG = cfg["config"]
global SECRETS
SECRETS = cfg["secret"]
except Exception as e:
print(f"Error reading Config Data: {e}")
# the config.json contains the following main nodes:
# #######################
# "secret"
# #######################
# the secret key contains the following items:
# the BOT_TOKEN is the Oauth2 token for your bot
# example: "BOT_TOKEN" : "DFHEZRERZQRJTSUPERSECRETTTOKENUTZZH"
# The GUILD_ID is the ID of your Server - in the discord client,
# right click on your server and select " copy ID" to get it
# example: "GUILD_ID" : "0236540000563456"
# The client ID can be copied from your App settings page and is needed
# to authenticate with the Discord Restful API for Event creation
# example "CLIENT_ID" : "9990236500564536"
# #######################
# "config"
# #######################
# the config node contains all generic config items, such as channel IDs
# and scheduler variables
# CHANNEL_IDLE_INTERVAL (number)
# the number of scheduler cycles that the channel needs to be idle
# before the bot posts a generic "did you know"
# message
CHANNEL_IDLE_INTERVAL: int = 4
# IDLE_MESSAGE_DIR (path without trailing slash)
# the name of the directory where the text files are
# located which contain the messages
# which the bot will randomly send
# (1 file = 1 message)
IDLE_MESSAGE_DIR: str = "bot_messages"
# IDLE_MESSAGE_CHANNEL_ID
# the channel where the bot will post messages to
IDLE_MESSAGE_CHANNEL_ID = 758271650226765848
# Variable that indicates when the bot answers after a question has been asked
# QUESTION_SLEEPING_TIME (number)
# # Variable that indicates when the bot answers after a question has been asked
# (in scheduler cycles)
QUESTION_SLEEPING_TIME = 2
# #######################
# "AUTO_EVENTS"
# #######################
# The Auto Events.
# this is used in three contexts:
# 1. Automatic creation of the event
# 2. Automatic reminder of subscribed users
# 3. in the /subscribe command
# ALL TIMES LOCAL TIMEZONE OF THE BOT !!!!
AUTO_EVENTS = [
{
'title':"Sunday Funday session (AM)",
'description':"Chat with Marc and the folks here on the server ! Share your screen if you want to walk through a problem. Talk about tech stuff with the other members or just listen in...",
'channel':758271650688008202,
'notify_hint':'get notified when the AM session starts',
'subscription_role':'notify_am',
'subscription_role_num':764893618066161695,
'notify_minutes':30,
'day_of_week':6,
'start_time':"09:00:00",
'end_time':"10:00:00"
},
{
'title':"Sunday Funday session (PM)",
'description':"Chat with Marc and the folks here on the server ! Share your screen if you want to walk through a problem. Talk about tech stuff with the other members or just listen in...",
'channel':758271650688008202,
'notify_hint':'get notified when the PM session starts',
'subscription_role':'notify_pm',
'subscription_role_num':769829891419537448,
'notify_minutes':30,
'day_of_week':6,
'start_time':"18:00:00",
'end_time':"19:00:00"
}
]
# this needs to be an array of dict