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 (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/QPixel/orderedmap"
|
"github.com/QPixel/orderedmap"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package framework
|
||||||
|
|
||||||
import "github.com/dlclark/regexp2"
|
import "github.com/dlclark/regexp2"
|
||||||
|
|
||||||
|
|
@ -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 -- //
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
@ -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
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -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
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package framework
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
Loading…
Reference in New Issue