remove package core, remove setstatus in core.go
This commit is contained in:
parent
43216b2819
commit
9af0a24281
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package framework
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package framework
|
||||
|
||||
import (
|
||||
"github.com/QPixel/orderedmap"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package framework
|
||||
|
||||
import "github.com/dlclark/regexp2"
|
||||
|
||||
|
|
@ -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 -- //
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package framework
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package framework
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package framework
|
||||
|
||||
// handlers.go
|
||||
// Everything required for commands to pass their own handlers to discordgo
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package framework
|
||||
|
||||
import (
|
||||
"github.com/bwmarrin/discordgo"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package framework
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
@ -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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package core
|
||||
package framework
|
||||
|
||||
import (
|
||||
"sync"
|
||||
Loading…
Reference in New Issue