You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package main
import (
var config = readConfig()
var commands []*Command
func main() {
dg, err := discordgo.New("Bot " + config.Token)
if err != nil {
fmt.Println("error: ", err)
defer dg.Close()
err = dg.Open()
if err != nil {
fmt.Println("No connection:\n", err)
f, err := os.OpenFile("selphybot.log", os.O_RDWR | os.O_CREATE | os.O_APPEND, 0666)
if err != nil {
fmt.Println("Error opening log file:\n", err)
defer f.Close()
dg.UpdateStatus(0, "!help")
fmt.Println("Bot running. selphyWoo")
log.Println("Bot running. selphyWoo")
sc := make(chan os.Signal, 1)
signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill)
// Ill just put all of the commands here for now.
func addCommands() {
// Moderation
registerCommand(Command{Trigger: "(\\s|\n|^)[nN][hH]([ ?.,\n]|$)", Output: "<@%s> „nh“ ist kein Wort, du Oboe!", DeleteInput: true, OutputIsReply: true, Type: CommandTypeRegex})
registerCommand(Command{Trigger: "einzigste", Output: "<@%s> Es heißt „einzige“, du Tuba.", DeleteInput: true, OutputIsReply: true, Type: CommandTypeContains})
// Misc
registerCommand(Command{Trigger: "<@%s> <3", Output: "<@%s> <3", Type: CommandTypeFullMatch, AdminOnly: false, OutputIsReply: true, RequiresMention: true})
registerCommand(Command{Trigger: "ist flauschig", Output: "Du bist flauschig! <3", Type: CommandTypeContains})
fmt.Printf("Successfully initialized %d commands\n", len(commands))
log.Printf("Successfully initialized %d commands", len(commands))