0

Move settings routines to separate internal module

This commit is contained in:
eleksir
2025-10-12 11:58:03 +03:00
parent 24507ed6b4
commit 79840796f6
5 changed files with 41 additions and 26 deletions

View File

@@ -6,6 +6,8 @@ import (
"regexp"
"strings"
"aleesa-irc-go/internal/setting"
log "github.com/sirupsen/logrus"
)
@@ -98,11 +100,11 @@ func ircMsgParser(channel string, nick string, user string, source string, msg s
case cmd == "admin oboobs":
if userModeIsOped(channel, nick) {
value := getSetting(channel, "oboobs")
value := setting.Get(channel, "oboobs")
switch value {
case "":
_ = saveSetting(channel, "oboobs", "0")
_ = setting.Set(channel, "oboobs", "0")
imChan <- iMsg{ChatID: nick, Text: "Плагин oboobs выключен"}
case "0":
imChan <- iMsg{ChatID: nick, Text: "Плагин oboobs выключен"}
@@ -117,7 +119,7 @@ func ircMsgParser(channel string, nick string, user string, source string, msg s
case cmd == "admin oboobs 1":
if userModeIsOped(channel, nick) {
err := saveSetting(channel, "oboobs", "1")
err := setting.Set(channel, "oboobs", "1")
if err != nil {
imChan <- iMsg{ChatID: nick, Text: "Плагин oboobs всё ещё выключен"}
@@ -130,7 +132,7 @@ func ircMsgParser(channel string, nick string, user string, source string, msg s
case cmd == "admin oboobs 0":
if userModeIsOped(channel, nick) {
_ = saveSetting(channel, "oboobs", "0")
_ = setting.Set(channel, "oboobs", "0")
imChan <- iMsg{ChatID: nick, Text: "Плагин oboobs выключен"}
}
@@ -138,11 +140,11 @@ func ircMsgParser(channel string, nick string, user string, source string, msg s
case cmd == "admin obutts":
if userModeIsOped(channel, nick) {
value := getSetting(channel, "obutts")
value := setting.Get(channel, "obutts")
switch value {
case "":
_ = saveSetting(channel, "obutts", "0")
_ = setting.Set(channel, "obutts", "0")
imChan <- iMsg{ChatID: nick, Text: "Плагин obutts выключен"}
case "0":
imChan <- iMsg{ChatID: nick, Text: "Плагин obutts выключен"}
@@ -157,7 +159,7 @@ func ircMsgParser(channel string, nick string, user string, source string, msg s
case cmd == "admin obutts 1":
if userModeIsOped(channel, nick) {
err := saveSetting(channel, "obutts", "1")
err := setting.Set(channel, "obutts", "1")
if err != nil {
imChan <- iMsg{ChatID: nick, Text: "Плагин obutts всё ещё выключен"}
@@ -170,7 +172,7 @@ func ircMsgParser(channel string, nick string, user string, source string, msg s
case cmd == "admin obutts 0":
if userModeIsOped(channel, nick) {
_ = saveSetting(channel, "obutts", "0")
_ = setting.Set(channel, "obutts", "0")
imChan <- iMsg{ChatID: nick, Text: "Плагин obutts выключен"}
}
@@ -262,7 +264,7 @@ func ircMsgParser(channel string, nick string, user string, source string, msg s
// Отключаемые команды
if !done {
value := getSetting(channel, "obutts")
value := setting.Get(channel, "obutts")
if value == "1" {
cmds := []string{"butt", "booty", "ass", "попа", "попка"}
@@ -279,7 +281,7 @@ func ircMsgParser(channel string, nick string, user string, source string, msg s
}
if !done {
value = getSetting(channel, "oboobs")
value = setting.Get(channel, "oboobs")
if value == "1" {
cmds := []string{"tits", "boobs", "tities", "boobies", "сиси", "сисечки"}