3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00
PyLink/world.py
2015-09-19 11:51:56 -07:00

31 lines
866 B
Python

# world.py: global state variables go here
from collections import defaultdict
import threading
import subprocess
# Global variable to indicate whether we're being ran directly, or imported
# for a testcase.
testing = True
global bot_commands, command_hooks
# This should be a mapping of command names to functions
bot_commands = defaultdict(list)
command_hooks = defaultdict(list)
networkobjects = {}
schedulers = {}
plugins = []
whois_handlers = []
started = threading.Event()
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".')