You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To set a field other than the default (for example, a Symphony key on disk rather than in the environment), override it in your own config:
30
+
Symphony needs a host, a bot username, and either a certificate or an RSA private key.
31
+
The built-in preset uses certificate authentication with a combined certificate/key `.pem` file on disk (`bot_certificate_path`); a path keeps long-lived key material out of the process environment.
32
+
33
+
Discord's `message_content` is a [privileged intent](https://discord.com/developers/docs/topics/gateway#privileged-intents).
34
+
The built-in preset requests it, but it must also be enabled for the bot in the Discord Developer Portal, or the bot will not receive command text in guild channels.
35
+
36
+
To set a field other than the defaults — for example, to authenticate Symphony with an RSA key instead of a certificate — override it in your own config:
31
37
32
38
```yaml
33
39
# @package modules.bot.config
34
40
symphony:
35
41
config:
36
42
bot_private_key_path: /path/to/bot-key.pem
37
-
bot_certificate_path: /path/to/bot-cert.pem
38
43
```
39
44
40
45
For platform-specific setup of tokens and bot accounts, follow the adapter guides:
Copy file name to clipboardExpand all lines: docs/wiki/Writing-Commands.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ class HelloCommand(ReplyToOtherCommand):
32
32
ifnot command.targets:
33
33
returnNone
34
34
mentions = mention_users(
35
-
[t.to_chatom_user() for t incommand.targets],
35
+
list(command.targets),
36
36
command.backend,
37
37
)
38
38
return Message(
@@ -51,7 +51,9 @@ class HelloCommandModel(BaseCommandModel):
51
51
## Register the command
52
52
53
53
Commands are selected by configuration.
54
-
Put `hello.py` next to a bot config and list the command alongside the built-ins:
54
+
`csp-bot` imports each command by its `_target_`, so `hello.py` must be importable on the `PYTHONPATH` (for example, run from the directory that contains it, or ship it as part of an installed package).
55
+
56
+
List your command alongside the built-ins:
55
57
56
58
**my_bot/bot/slack.yaml**
57
59
@@ -67,13 +69,16 @@ gateway:
67
69
commands:
68
70
- /commands/help
69
71
- /commands/echo
72
+
- /commands/schedule
73
+
- /commands/status
70
74
- _target_: hello.HelloCommandModel
71
75
```
72
76
73
-
Then start the bot, pointing Hydra at your config directory so it can import `hello.py`:
77
+
`gateway.commands` replaces the default command list, so include the built-ins you want to keep.
78
+
Then start the bot, adding the config directory to both Hydra's search path and Python's import path:
0 commit comments