This repository was archived by the owner on Jun 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathts3plugin.py
More file actions
64 lines (54 loc) · 2.33 KB
/
ts3plugin.py
File metadata and controls
64 lines (54 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import ts3lib
import ts3defines
from pluginhost import PluginHost
import pytson
class PluginMount(type, pytson.Translatable):
def __init__(cls, name, bases, attrs):
super(PluginMount, cls).__init__(name, bases, attrs)
if not hasattr(PluginHost, 'plugins'):
PluginHost.plugins = {}
PluginHost.active = {}
else:
for a in ['requestAutoload', 'name', 'version', 'apiVersion',
'author', 'description', 'offersConfigure',
'commandKeyword', 'infoTitle', 'menuItems', 'hotkeys']:
if not hasattr(cls, a):
msg = cls._tr("Plugin {name} not loaded, missing required "
"attribute {attrib}").format(name=name,
attrib=a)
err = ts3lib.logMessage(msg,
ts3defines.LogLevel.LogLevel_ERROR,
"pyTSon.PluginMount.init", 0)
if err != ts3defines.ERROR_ok:
print(msg)
return
if cls.name not in PluginHost.plugins:
PluginHost.plugins[cls.name] = cls
else:
msg = cls._tr("Error loading python plugin {name}, already "
"registered or a plugin with that name already "
"exists").format(name=cls.name)
err = ts3lib.logMessage(msg,
ts3defines.LogLevel.LogLevel_ERROR,
"pyTSon.PluginMount.init", 0)
if err != ts3defines.ERROR_ok:
print(msg)
class ts3plugin(object, metaclass=PluginMount):
"""
requestAutoload = False
name = "__ts3plugin__"
version = "1.0"
apiVersion = 23
author = "Thomas \"PLuS\" Pathmann"
description = "This is the baseclass for all ts3 python plugins"
offersConfigure = False
commandKeyword = "py"
infoTitle = "pyTSon" #pass None to not show any info
menuItems = []#[(ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT, 0,
"text", "icon.png")]
hotkeys = []#[("keyword", "description")]
"""
def __init__(self):
pass
def stop(self):
pass