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 ( import (
"errors" "errors"

View File

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

View File

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

View File

@ -1,4 +1,4 @@
package core package framework
import ( import (
"github.com/bwmarrin/discordgo" "github.com/bwmarrin/discordgo"
@ -137,19 +137,7 @@ func Start() {
// Bot ready // Bot ready
log.Info("Initialization complete! The bot is now 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 // Info about slash commands
log.Info(<-slashChannel) log.Info(<-slashChannel)
// -- GRACEFUL TERMINATION -- // // -- GRACEFUL TERMINATION -- //

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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