Chatbot Object Macros: NSFW and Send Message
This commit is contained in:
parent
d651f96678
commit
e600250908
|
@ -54,6 +54,19 @@ func (h *BotHandlers) setObjectMacros() {
|
||||||
return "[react: invalid number of parameters]"
|
return "[react: invalid number of parameters]"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Mark a camera NSFW for a username.
|
||||||
|
h.rs.SetSubroutine("nsfw", func(rs *rivescript.RiveScript, args []string) string {
|
||||||
|
if len(args) >= 1 {
|
||||||
|
var username = strings.TrimPrefix(args[0], "@")
|
||||||
|
h.client.Send(messages.Message{
|
||||||
|
Action: messages.ActionMessage,
|
||||||
|
Message: fmt.Sprintf("/nsfw %s", username),
|
||||||
|
})
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return "[nsfw: invalid number of parameters]"
|
||||||
|
})
|
||||||
|
|
||||||
// Takeback a message (admin action especially)
|
// Takeback a message (admin action especially)
|
||||||
h.rs.SetSubroutine("takeback", func(rs *rivescript.RiveScript, args []string) string {
|
h.rs.SetSubroutine("takeback", func(rs *rivescript.RiveScript, args []string) string {
|
||||||
if len(args) >= 1 {
|
if len(args) >= 1 {
|
||||||
|
@ -120,4 +133,25 @@ func (h *BotHandlers) setObjectMacros() {
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Send a public chat message to a channel name.
|
||||||
|
h.rs.SetSubroutine("send-message", func(rs *rivescript.RiveScript, args []string) string {
|
||||||
|
if len(args) >= 2 {
|
||||||
|
var (
|
||||||
|
channel = args[0]
|
||||||
|
message = strings.Join(args[1:], " ")
|
||||||
|
)
|
||||||
|
|
||||||
|
// Slide into their DMs.
|
||||||
|
log.Error("Send chat to [%s]: %s", channel, message)
|
||||||
|
h.client.Send(messages.Message{
|
||||||
|
Action: messages.ActionMessage,
|
||||||
|
Channel: channel,
|
||||||
|
Message: message,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return "[send-message: invalid number of parameters]"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,6 +171,25 @@ Example: say you have a global keyword trigger on public rooms and want to DM a
|
||||||
< topic
|
< topic
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** the `dm` command will auto insert the @ prefix for the channel name, so it can only send to DM threads. Use `send-message` for the ability to send a message to a public channel (or DM thread) by having more control over the exact spelling of the channel name.
|
||||||
|
|
||||||
|
## Send Message
|
||||||
|
|
||||||
|
Send a chat message to a public channel. Like the `dm` macro but doesn't assume it to be a DM thread.
|
||||||
|
|
||||||
|
Usage: `send-message <channel> <message to send>`
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```rivescript
|
||||||
|
+ to * send the message *
|
||||||
|
* <get isAdmin> <> true => This command is only available to operators.
|
||||||
|
- I will send that to the <star1> channel.
|
||||||
|
^ <call>send-message <star1> "{sentence}<star2>{/sentence}"</call>
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you could say: "to lobby send the message hey everyone" to send to a public channel (by its internal ID), or "to @soandso send the message hey there" to send it to a DM thread.
|
||||||
|
|
||||||
## Takeback
|
## Takeback
|
||||||
|
|
||||||
Take back a message by its ID. This may be useful if you have a global moderator trigger set up so you can remove a user's message.
|
Take back a message by its ID. This may be useful if you have a global moderator trigger set up so you can remove a user's message.
|
||||||
|
@ -211,3 +230,17 @@ Example:
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: the `report` command returns no text (except on error).
|
Note: the `report` command returns no text (except on error).
|
||||||
|
|
||||||
|
## NSFW
|
||||||
|
|
||||||
|
Send a BareRTC `/nsfw` operator command to mark a user's camera as Explicit.
|
||||||
|
|
||||||
|
Usage: `nsfw <username>`
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```rivescript
|
||||||
|
+ please mark the camera red for *
|
||||||
|
- I will issue the NSFW camera command for: <star>
|
||||||
|
^ <call>nsfw <star></call>
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue
Block a user