remove package core, remove setstatus in core.go

This commit is contained in:
vel 2021-07-13 12:27:47 -07:00
parent 43216b2819
commit 9af0a24281
Signed by: velvox
GPG Key ID: 1C8200C1D689CEF5
11 changed files with 29 additions and 29 deletions

View File

@ -1,4 +1,4 @@
package core
package framework
import (
"errors"

View File

@ -1,4 +1,4 @@
package core
package framework
import (
"github.com/QPixel/orderedmap"

View File

@ -1,4 +1,4 @@
package core
package framework
import "github.com/dlclark/regexp2"

View File

@ -1,4 +1,4 @@
package core
package framework
import (
"github.com/bwmarrin/discordgo"
@ -137,19 +137,7 @@ func Start() {
// Bot ready
log.Info("Initialization complete! The bot is now ready.")
// Set the bots status
var timeSinceIdle = 91879201
Session.UpdateStatusComplex(discordgo.UpdateStatusData{
Activities: []*discordgo.Activity{
{
Name: "Mega Man Battle Network",
Type: 0,
},
},
Status: "dnd",
AFK: true,
IdleSince: &timeSinceIdle,
})
// Info about slash commands
log.Info(<-slashChannel)
// -- GRACEFUL TERMINATION -- //

View File

@ -1,4 +1,4 @@
package core
package framework
import (
"encoding/json"

View File

@ -1,4 +1,4 @@
package core
package framework
import (
"errors"

View File

@ -1,4 +1,4 @@
package core
package framework
// handlers.go
// Everything required for commands to pass their own handlers to discordgo

View File

@ -1,4 +1,4 @@
package core
package framework
import (
"github.com/bwmarrin/discordgo"

View File

@ -1,4 +1,4 @@
package core
package framework
import (
"fmt"

View File

@ -1,9 +1,9 @@
package core
package framework
import (
"errors"
"github.com/bwmarrin/discordgo"
"regexp"
"github.com/dlclark/regexp2"
"strconv"
"strings"
)
@ -27,26 +27,38 @@ func RemoveItem(slice []string, delete string) []string {
// Given a string, ensure it contains only numbers
// This is useful for stripping letters and formatting characters from user/role pings
func EnsureNumbers(in string) string {
reg, err := regexp.Compile("[^0-9]+")
reg, err := regexp2.Compile("[^0-9]+", 0)
if err != nil {
log.Errorf("An unrecoverable error occurred when compiling a regex expression: %s", err)
return ""
}
return reg.ReplaceAllString(in, "")
str, err := reg.Replace(in, "", 0, 0)
if err != nil {
log.Errorf("Unable to replace text in EnsureNumbers")
return ""
}
return str
}
// EnsureLetters
// Given a string, ensure it contains only letters
// This is useful for stripping numbers from mute durations, and possibly other things
func EnsureLetters(in string) string {
reg, err := regexp.Compile("[^a-zA-Z]+")
reg, err := regexp2.Compile("[^a-zA-Z]+", 0)
if err != nil {
log.Errorf("An unrecoverable error occurred when compiling a regex expression: %s", err)
return ""
}
return reg.ReplaceAllString(in, "")
str, err := reg.Replace(in, "", 0, 0)
if err != nil {
log.Errorf("Unable to replace text in EnsureLetters")
return ""
}
return str
}
// CleanId

View File

@ -1,4 +1,4 @@
package core
package framework
import (
"sync"