@@ -11,31 +11,114 @@ opt_plugins:
1111
1212The plugin itself needs to be configured with a yaml file in config/plugins/commands.yaml. Each command has a name and
1313parameters. These parameters can be used in the arguments you use to call your external program. The sample shows how
14- to launch DCS from a specific command (not really useful as you have . startup, but you get the idea) and dir as a shell
15- command.
14+ to launch DCS from a specific command (not really useful as you have ` /server startup` , but you get the idea) and ` dir`
15+ as a shell command.
1616
1717` ` ` yaml
1818commands:
19- - name : dcs # Create a command .dcs
20- roles : # that can be run by the DCS Admin role
21- - DCS Admin
22- execute : # and map it to a call of DCS_server.exe
23- cmd : DCS_server.exe
24- args : -w {instance}
25- cwd : C:\Program Files\Eagle Dynamics\DCS World Server\bin
26- params : # which receives a parameter "instance" (will be auto replaced by the instance name)
27- - instance
28- - name : dir # Create a command .dir
29- roles : # which can be run by Admin and DCS Admin
30- - Admin
31- - DCS Admin
32- execute : # and that maps to a shell command "dir c:\"
33- cmd : dir
34- cwd : C:\
35- shell : true
36- hidden : true # the .dir command will not apply in the help command
19+ startup: # Create a command /startup
20+ roles: # that can be run by the DCS Admin role
21+ - DCS Admin
22+ execute: # and map it to a call of DCS_server.exe
23+ cmd: DCS_server.exe
24+ args: -w {instance.name}
25+ cwd: C:\P rogram Files\E agle Dynamics\D CS World Server\b in
26+ params: # parameter list
27+ instance: # instance parameters have auto completion
28+ required: true # mandatory parameter
29+ dir: # Command /dir
30+ description: shows a directory listing
31+ roles: # dir can be executed be Admin and DCS Admin
32+ - Admin
33+ - DCS Admin
34+ execute:
35+ shell: true # Run dir as a shell command. You want to use this also for bat or cmd files.
36+ cmd: dir
37+ cwd: '{path}'
38+ args: '{option}'
39+ params:
40+ option:
41+ description: Options for the dir command
42+ type: str
43+ required: false
44+ path:
45+ description: Directory listing of this path
46+ type: str
47+ required: false
48+ default: C:\P rogram Files\E agle Dynamics\D CS World
49+ setflag:
50+ roles:
51+ - DCS Admin
52+ event: # Instead of running a command, send an event to DCS
53+ command: setFlag # setFlag takes 2 parameters
54+ flag: '{flag}'
55+ value: '{value}'
56+ params:
57+ server: # we need to provide a server for events, otherwise they will be run on all servers
58+ required: true
59+ flag:
60+ description: Flag to be set
61+ required: true
62+ type: int
63+ choices:
64+ - 100
65+ - 110
66+ - 120
67+ value:
68+ description: Value to set
69+ type: int
70+ required: true
71+ choices:
72+ - 1
73+ - 2
74+ - 3
3775` ` `
38- > [!NOTE]
39- > * DCSServerBot needs to have the permissions to launch the respective executable!
40- > * Do not run long-running shell scripts!
41- > + These commands are NO slash commands, so they start with another prefix, set in the configuration!
76+ > [!IMPORTANT]
77+ > DCSServerBot needs to have the permission to launch the respective executables.
78+
79+ > [!WARNING]
80+ > Do **not** run long-running shell scripts.
81+ > Normal tasks can be long-running. You have commands to terminate them (see below).
82+
83+ # ## Parameter Structure
84+ ` ` ` yaml
85+ params:
86+ name: # name of the parameter
87+ type: str # One of str, int, bool, member, channel, role, mentionable, number, attachment
88+ description: xxx # description of the parameter
89+ required: true # default: false
90+ default: xxx # A value to be set as default, if required = false. If not set, NONE will be applied.
91+ nsfw: false # Commands for NSFW-channels, default: false
92+ min_value: 0 # Optional: min value for range
93+ max_value: 10 # Optional: max value for range
94+ choices: # Optional: choice of values (type must match the type above)
95+ - A
96+ - B
97+ - C
98+ ` ` `
99+
100+ # ## Special Parameters
101+
102+ The following special parameters are supported and will be replaced by auto-completion if available :
103+ - node
104+ - instance
105+ - server
106+ - user
107+ - member
108+ - channel
109+ - role
110+
111+ These parameters will be passed as objects.<br>
112+ You can keep it simple in the params section :
113+ ` ` ` yaml
114+ params:
115+ server:
116+ required: true
117+ ` ` `
118+
119+ # # Discord Commands
120+
121+ | Command | Parameter | Channel | Role | Description |
122+ |:--------------------|:----------|:--------|:------|:-------------------------------------------------------------|
123+ | /commands tasklist | | all | Admin | Show all running processes that were started by this plugin. |
124+ | /commands terminate | process | all | Admin | Terminate a running process. |
0 commit comments