mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 11:51:17 +00:00
[template] Add mention
function
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
1a023099d9
commit
12911c712f
2 changed files with 15 additions and 0 deletions
|
@ -56,6 +56,8 @@ func init() {
|
|||
}
|
||||
})
|
||||
|
||||
tplFuncs.Register("mention", plugins.GenericTemplateFunctionGetter(func(username string) string { return "@" + strings.TrimLeft(username, "@#") }))
|
||||
|
||||
tplFuncs.Register("tag", func(m *irc.Message, r *plugins.Rule, fields *plugins.FieldCollection) interface{} {
|
||||
return func(tag string) string {
|
||||
s, _ := m.GetTag(tag)
|
||||
|
|
|
@ -246,6 +246,19 @@ Example:
|
|||
< Last Quote: #32
|
||||
```
|
||||
|
||||
#### `mention`
|
||||
|
||||
Strips username and converts into a mention
|
||||
|
||||
Syntax: `mention <username>`
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
# {{ mention "@user" }} {{ mention "user" }} {{ mention "#user" }}
|
||||
< @user @user @user
|
||||
```
|
||||
|
||||
#### `pow`
|
||||
|
||||
Returns float from calculation: `float1 ** float2`
|
||||
|
|
Loading…
Reference in a new issue