forked from kageru/discord-selphybot
split project into multiple files
This commit is contained in:
parent
0acb15b138
commit
93014d944b
|
@ -0,0 +1,40 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"encoding/json"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Embed struct {
|
||||||
|
Message string
|
||||||
|
QuestionsTitle string
|
||||||
|
QuestionsText string
|
||||||
|
BugsTitle string
|
||||||
|
BugsText string
|
||||||
|
Image string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
AdminID string
|
||||||
|
ServerID string
|
||||||
|
LockedRoleID string
|
||||||
|
Token string
|
||||||
|
WelcomeChannel string
|
||||||
|
GeneralChannel string
|
||||||
|
SendWelcomeDM bool
|
||||||
|
RequireAccept bool
|
||||||
|
ComplaintReceivedMessage string
|
||||||
|
ModChannel string
|
||||||
|
WelcomeEmbed Embed
|
||||||
|
RoleCommands map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func readConfig() Config {
|
||||||
|
file, _ := os.Open("config.json")
|
||||||
|
conf := Config{}
|
||||||
|
json.NewDecoder(file).Decode(&conf)
|
||||||
|
file.Close()
|
||||||
|
return conf
|
||||||
|
}
|
||||||
|
|
|
@ -2,51 +2,21 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"encoding/json"
|
|
||||||
"strings"
|
"strings"
|
||||||
"os"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
"regexp"
|
"regexp"
|
||||||
"log"
|
"log"
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Embed struct {
|
|
||||||
Message string
|
|
||||||
QuestionsTitle string
|
|
||||||
QuestionsText string
|
|
||||||
BugsTitle string
|
|
||||||
BugsText string
|
|
||||||
Image string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Config struct {
|
|
||||||
AdminID string
|
|
||||||
ServerID string
|
|
||||||
LockedRoleID string
|
|
||||||
Token string
|
|
||||||
WelcomeChannel string
|
|
||||||
GeneralChannel string
|
|
||||||
SendWelcomeDM bool
|
|
||||||
RequireAccept bool
|
|
||||||
ComplaintReceivedMessage string
|
|
||||||
ModChannel string
|
|
||||||
WelcomeEmbed Embed
|
|
||||||
RoleCommands map[string]string
|
|
||||||
}
|
|
||||||
|
|
||||||
var config = readConfig()
|
var config = readConfig()
|
||||||
|
var commands []Command
|
||||||
func readConfig() Config {
|
var t CommandType
|
||||||
file, _ := os.Open("config.json")
|
|
||||||
conf := Config{}
|
|
||||||
_ = json.NewDecoder(file).Decode(&conf)
|
|
||||||
file.Close()
|
|
||||||
return conf
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
fmt.Println(t)
|
||||||
dg, err := discordgo.New("Bot " + config.Token)
|
dg, err := discordgo.New("Bot " + config.Token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("error: ", err)
|
fmt.Println("error: ", err)
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
type CommandType int
|
||||||
|
|
||||||
|
const (
|
||||||
|
CommandTypePrefix CommandType = 0
|
||||||
|
CommandTypeFullMatch CommandType = 1
|
||||||
|
CommandTypeRegex CommandType = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
type Command struct {
|
||||||
|
Input string
|
||||||
|
Output string
|
||||||
|
Type CommandType
|
||||||
|
OutputIsReply bool
|
||||||
|
DeleteInput bool
|
||||||
|
DMOnly bool
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user