mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
[automessage] Add disable switch
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
21f9f80f3d
commit
653d952e79
2 changed files with 40 additions and 0 deletions
|
@ -25,6 +25,7 @@ type autoMessage struct {
|
|||
Message string `json:"message,omitempty" yaml:"message,omitempty"`
|
||||
UseAction bool `json:"use_action,omitempty" yaml:"use_action,omitempty"`
|
||||
|
||||
Disable bool `json:"disable,omitempty" yaml:"disable,omitempty"`
|
||||
DisableOnTemplate *string `json:"disable_on_template,omitempty" yaml:"disable_on_template,omitempty"`
|
||||
|
||||
Cron string `json:"cron,omitempty" yaml:"cron,omitempty"`
|
||||
|
@ -83,6 +84,13 @@ func (a *autoMessage) CanSend() bool {
|
|||
}
|
||||
}
|
||||
|
||||
if a.Disable {
|
||||
log.Trace("Auto-Message disabled by flag")
|
||||
// Reset the timer for this execution not to spam every second
|
||||
a.lastMessageSent = time.Now()
|
||||
return false
|
||||
}
|
||||
|
||||
if !a.allowExecuteDisableOnTemplate() {
|
||||
log.Trace("Auto-Message disabled by template")
|
||||
// Reset the timer for this execution not to spam every second
|
||||
|
|
|
@ -45,6 +45,29 @@
|
|||
<code>{{ data.value }}</code>
|
||||
</template>
|
||||
|
||||
<template #cell(message)="data">
|
||||
{{ data.value }}<br>
|
||||
<b-badge
|
||||
v-if="data.item.disable"
|
||||
class="mt-1 mr-1"
|
||||
variant="danger"
|
||||
>
|
||||
Disabled
|
||||
</b-badge>
|
||||
<b-badge
|
||||
v-if="data.item.disable_on_template"
|
||||
class="mt-1 mr-1"
|
||||
>
|
||||
Disable on Template
|
||||
</b-badge>
|
||||
<b-badge
|
||||
v-if="data.item.only_on_live"
|
||||
class="mt-1 mr-1"
|
||||
>
|
||||
Only during Stream
|
||||
</b-badge>
|
||||
</template>
|
||||
|
||||
<template #head(actions)="">
|
||||
<b-button-group size="sm">
|
||||
<b-button
|
||||
|
@ -182,6 +205,15 @@
|
|||
</b-form-checkbox>
|
||||
</b-form-group>
|
||||
|
||||
<b-form-group>
|
||||
<b-form-checkbox
|
||||
v-model="models.autoMessage.disable"
|
||||
switch
|
||||
>
|
||||
Disable Auto-Message entirely
|
||||
</b-form-checkbox>
|
||||
</b-form-group>
|
||||
|
||||
<b-form-group
|
||||
label="Disable on Template"
|
||||
label-for="formAutoMessageDisableOnTemplate"
|
||||
|
|
Loading…
Reference in a new issue