[ALPHA] Discord works

This commit is contained in:
Minecodes 2023-07-16 21:43:59 +02:00
parent 1ca7055882
commit 6632707642
Signed by: thies
GPG key ID: E6CD3105E59C12D1
13 changed files with 26 additions and 49 deletions

View file

@ -1,11 +0,0 @@
module git.minecodes.de/thies/Tatake/cmds
go 1.20
require github.com/bwmarrin/discordgo v0.27.1
require (
github.com/gorilla/websocket v1.4.2 // indirect
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 // indirect
)

View file

@ -1,12 +0,0 @@
github.com/bwmarrin/discordgo v0.27.1 h1:ib9AIc/dom1E/fSIulrBwnez0CToJE113ZGt4HoliGY=
github.com/bwmarrin/discordgo v0.27.1/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b h1:7mWr3k41Qtv8XlltBkDkl8LoP3mpSgBW8BUoxtEdbXg=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View file

@ -1,4 +1,4 @@
package cmds
package main
import (
"fmt"

View file

@ -1,4 +1,4 @@
package cmds
package main
import (
"encoding/json"

2
go.sum
View file

@ -1,3 +1,5 @@
git.minecodes.de/thies/Tatake/cmds v0.0.0-20230716193632-1ca705588277 h1:Om78HH47wWzt5jsZpQG3m69eHohT+myW1CT6eji2qG0=
git.minecodes.de/thies/Tatake/cmds v0.0.0-20230716193632-1ca705588277/go.mod h1:8yK0SsOyQrg2jNU3fVG0AcIep13RjJfIgM4DHMpr9EY=
github.com/agnivade/wasmbrowsertest v0.3.1/go.mod h1:zQt6ZTdl338xxRaMW395qccVE2eQm0SjC/SDz0mPWQI=
github.com/bwmarrin/discordgo v0.27.1 h1:ib9AIc/dom1E/fSIulrBwnez0CToJE113ZGt4HoliGY=
github.com/bwmarrin/discordgo v0.27.1/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY=

View file

@ -1,4 +1,4 @@
package cmds
package main
import (
"fmt"

View file

@ -1,4 +1,4 @@
package cmds
package main
import (
"fmt"

32
main.go
View file

@ -24,12 +24,10 @@ import (
)
var (
GuildID = flag.String("guild", "", "Test guild ID. If not passed - bot registers commands globally")
BotToken = flag.String("token", "", "Bot access token")
RemoveCommands = flag.Bool("rmcmd", true, "Remove all commands after shutdowning or not")
minPasswordLength = float64(12)
maxPasswordLength = float64(100)
InfoMessages = []string{
GuildID = flag.String("guild", "", "Test guild ID. If not passed - bot registers commands globally")
BotToken = flag.String("token", "", "Bot access token")
RemoveCommands = flag.Bool("rmcmd", true, "Remove all commands after shutdowning or not")
InfoMessages = []string{
`Hello, I'm a bot made by <@!556848982433857537>!`,
`Hello SlimeDiamond`,
`"Never trust a tech guy with a rat tail—too easy to carve secrets out of him." - Lone Star (Mr. Robot)`,
@ -177,15 +175,15 @@ var (
}
commandHandlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
"trains": cmds.dcTrains,
"ping": cmds.dcPing,
"weather": cmds.dcWeather,
"gh": cmds.dcGhUser,
"httpdog": cmds.dcHTTPDog,
"httpcat": cmds.dcHTTPCat,
"fox": cmds.dcFox,
"qrcode": cmds.dcQRCode,
"password": cmds.dcPassword,
"trains": dcTrains,
"ping": dcPing,
"weather": dcWeather,
"gh": dcGhUser,
"httpdog": dcHTTPDog,
"httpcat": dcHTTPCat,
"fox": dcFox,
"qrcode": dcQRCode,
"password": dcPassword,
}
)
@ -267,8 +265,8 @@ func xmppBot(wg *sync.WaitGroup) {
TransportConfiguration: xmpp.TransportConfiguration{
Address: "etc.minecodes.de:5222",
},
Jid: "tatake@etc.minecodes.de",
Credential: xmpp.Password("T*AM5%843#H&w!6krd&!"),
Jid: "",
Credential: xmpp.Password(""),
StreamLogger: os.Stdout,
Insecure: false,
// TLSConfig: tls.Config{InsecureSkipVerify: true},

View file

@ -1,4 +1,4 @@
package cmds
package main
import (
"math/rand"

View file

@ -1,4 +1,4 @@
package cmds
package main
import (
"github.com/bwmarrin/discordgo"

View file

@ -1,4 +1,4 @@
package cmds
package main
import (
"github.com/bwmarrin/discordgo"

View file

@ -1,4 +1,4 @@
package cmds
package main
import (
"github.com/bwmarrin/discordgo"

View file

@ -1,4 +1,4 @@
package cmds
package main
import (
"io/ioutil"