@@ -4,39 +4,18 @@ export interface SinusbotMeta {
44 description : string ,
55 author : string ,
66 hidden ?: boolean ,
7- requiredModules ?: string [ ] ,
7+ requiredModules ?: ModulesWithSpecialPermission [ ] ,
88 backends ?: Backends [ ] ,
99 engine ?: string ,
10- vars ?: Config < any > [ ] ,
10+ vars ?: ConfigEntries [ ] ,
1111 autorun ?: boolean ,
1212 enableweb ?: boolean
1313}
1414
15- export declare type Backends = "ts3" | "discord"
15+ export type ModulesWithSpecialPermission = "http" | "net" | "ws" | "db" | "fs" | "graphic"
16+ export type Backends = "ts3" | "discord"
1617
17-
18- export interface Config < T > {
19- type : string
20- /** key name in the config object */
21- name : string ,
22- /** display name in the webinterface */
23- title : string ,
24- /** default variable if nothing has been set */
25- default ?: T ,
26- /** placeholder data in the webinterface */
27- placeholder ?: string
28- indent ?: number ,
29- //displays a config option depending on the config name and the value
30- conditions ?: {
31- field : string ,
32- value : any
33- } [ ]
34- options ?: string [ ]
35- vars ?: Config < any > [ ]
36- }
37-
38- //maybe for future sinusbot versions
39- export type ConfigEntry =
18+ export type ConfigEntries =
4019 StringEntry |
4120 StringsEntry |
4221 PasswordEntry |
@@ -47,50 +26,81 @@ export type ConfigEntry =
4726 ChannelEntry |
4827 CheckboxEntry |
4928 SelectEntry |
50- ArrayEntry < any >
29+ ArrayEntry
30+
31+ export type ConfigTypes =
32+ "string" |
33+ "strings" |
34+ "password" |
35+ "multiline" |
36+ "number" |
37+ "track" |
38+ "tracks" |
39+ "channel" |
40+ "checkbox" |
41+ "select" |
42+ "array"
43+
44+ export interface BaseConfig < T > {
45+ readonly type : ConfigTypes
46+ /** key name in the config object */
47+ readonly name : string ,
48+ /** display name in the webinterface */
49+ readonly title : string ,
50+ /** default variable if nothing has been set */
51+ readonly default : T ,
52+ /** placeholder data in the webinterface */
53+ readonly placeholder ?: string
54+ readonly indent ?: number ,
55+ //displays a config option depending on the config name and the value
56+ readonly conditions ?: {
57+ readonly field : string ,
58+ readonly value : any
59+ } [ ]
60+ }
5161
52- export interface StringEntry extends Config < String > {
53- type : "string" ,
62+ export interface StringEntry extends BaseConfig < String > {
63+ readonly type : "string"
5464}
5565
56- export interface StringsEntry extends Config < String [ ] > {
57- type : "strings" ,
66+ export interface StringsEntry extends BaseConfig < String [ ] > {
67+ readonly type : "strings"
5868}
5969
60- export interface PasswordEntry extends Config < String > {
61- type : "password" ,
70+ export interface PasswordEntry extends BaseConfig < String > {
71+ readonly type : "password"
6272}
6373
64- export interface MultilineEntry extends Config < String > {
65- type : "multiline" ,
74+ export interface MultilineEntry extends BaseConfig < String > {
75+ readonly type : "multiline"
6676}
6777
68- export interface NumberEntry extends Config < Number > {
69- type : "number" ,
78+ export interface NumberEntry extends BaseConfig < Number > {
79+ readonly type : "number"
7080}
7181
72- export interface TrackEntry extends Config < never > {
73- type : "track" ,
82+ export interface TrackEntry extends BaseConfig < never > {
83+ readonly type : "track"
7484}
7585
76- export interface TracksEntry extends Config < never > {
77- type : "tracks" ,
86+ export interface TracksEntry extends BaseConfig < never > {
87+ readonly type : "tracks"
7888}
7989
80- export interface ChannelEntry extends Config < never > {
81- type : "channel" ,
90+ export interface ChannelEntry extends BaseConfig < never > {
91+ readonly type : "channel"
8292}
8393
84- export interface CheckboxEntry extends Config < Number > {
85- type : "checkbox" ,
94+ export interface CheckboxEntry extends BaseConfig < Number > {
95+ readonly type : "checkbox"
8696}
8797
88- export interface SelectEntry extends Config < Number > {
89- type : "select" ,
90- options : string [ ]
98+ export interface SelectEntry extends BaseConfig < Number > {
99+ readonly type : "select"
100+ readonly options : string [ ]
91101}
92102
93- export interface ArrayEntry < T > extends Config < T [ ] > {
94- type : "array" ,
95- vars : ConfigEntry [ ]
103+ export interface ArrayEntry extends BaseConfig < any [ ] > {
104+ readonly type : "array"
105+ readonly vars : ConfigEntries [ ]
96106}
0 commit comments