2015-08-29 04:27:38 +02:00
|
|
|
# world.py: global state variables go here
|
|
|
|
|
2015-08-29 18:39:33 +02:00
|
|
|
from collections import defaultdict
|
|
|
|
import threading
|
2015-09-19 20:51:56 +02:00
|
|
|
import subprocess
|
2015-08-29 18:39:33 +02:00
|
|
|
|
2015-08-29 04:27:38 +02:00
|
|
|
# Global variable to indicate whether we're being ran directly, or imported
|
|
|
|
# for a testcase.
|
|
|
|
testing = True
|
|
|
|
|
2015-08-29 18:39:33 +02:00
|
|
|
global bot_commands, command_hooks
|
|
|
|
# This should be a mapping of command names to functions
|
2015-08-30 04:24:32 +02:00
|
|
|
bot_commands = defaultdict(list)
|
2015-08-29 18:39:33 +02:00
|
|
|
command_hooks = defaultdict(list)
|
|
|
|
networkobjects = {}
|
|
|
|
schedulers = {}
|
|
|
|
plugins = []
|
|
|
|
whois_handlers = []
|
|
|
|
started = threading.Event()
|
2015-09-19 20:51:56 +02:00
|
|
|
|
|
|
|
version = "<unknown>"
|
|
|
|
source = "https://github.com/GLolol/PyLink" # CHANGE THIS IF YOU'RE FORKING!!
|
|
|
|
|
|
|
|
# Only run this once.
|
|
|
|
if version == "<unknown>":
|
|
|
|
# Get version from Git tags.
|
|
|
|
try:
|
|
|
|
version = 'v' + subprocess.check_output(['git', 'describe', '--tags']).decode('utf-8').strip()
|
|
|
|
except:
|
|
|
|
log.exception('Failed to get version from "git describe --tags".')
|