forked from kageru/discord-selphybot
split project into multiple files
This commit is contained in:
parent
0acb15b138
commit
93014d944b
40
config.go
Normal file
40
config.go
Normal file
@ -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
|
||||
}
|
||||
|
0
config.json
Executable file → Normal file
0
config.json
Executable file → Normal file
38
main.go
Executable file → Normal file
38
main.go
Executable file → Normal file
@ -2,51 +2,21 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"os"
|
||||
"os/signal"
|
||||
"os"
|
||||
"syscall"
|
||||
"regexp"
|
||||
"log"
|
||||
"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()
|
||||
|
||||
func readConfig() Config {
|
||||
file, _ := os.Open("config.json")
|
||||
conf := Config{}
|
||||
_ = json.NewDecoder(file).Decode(&conf)
|
||||
file.Close()
|
||||
return conf
|
||||
}
|
||||
var commands []Command
|
||||
var t CommandType
|
||||
|
||||
func main() {
|
||||
fmt.Println(t)
|
||||
dg, err := discordgo.New("Bot " + config.Token)
|
||||
if err != nil {
|
||||
fmt.Println("error: ", err)
|
||||
|
20
types.go
Normal file
20
types.go
Normal file
@ -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