Hm
This commit is contained in:
		
							
								
								
									
										24
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								main.go
									
									
									
									
									
								
							@@ -26,7 +26,7 @@ type Config struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Discord struct {
 | 
			
		||||
	Token   string `toml:"client"`
 | 
			
		||||
	Token   string `toml:"token"`
 | 
			
		||||
	AppID	string	`toml:"appid"`
 | 
			
		||||
	GuildID string `toml:"guildid"`
 | 
			
		||||
}
 | 
			
		||||
@@ -128,9 +128,9 @@ var (
 | 
			
		||||
			Type: discordgo.MessageApplicationCommand,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
	commandsHandlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
 | 
			
		||||
		"rickroll-em": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
 | 
			
		||||
			err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
	commandsHandlers = map[string]func(client *discordgo.Session, i *discordgo.InteractionCreate){
 | 
			
		||||
		"rickroll-em": func(client *discordgo.Session, i *discordgo.InteractionCreate) {
 | 
			
		||||
			err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
				Type: discordgo.InteractionResponseChannelMessageWithSource,
 | 
			
		||||
				Data: &discordgo.InteractionResponseData{
 | 
			
		||||
					Content: "Operation rickroll has begun",
 | 
			
		||||
@@ -141,11 +141,11 @@ var (
 | 
			
		||||
				panic(err)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			ch, err := s.UserChannelCreate(
 | 
			
		||||
			ch, err := client.UserChannelCreate(
 | 
			
		||||
				i.ApplicationCommandData().TargetID,
 | 
			
		||||
			)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				_, err = s.FollowupMessageCreate(i.Interaction, true, &discordgo.WebhookParams{
 | 
			
		||||
				_, err = client.FollowupMessageCreate(i.Interaction, true, &discordgo.WebhookParams{
 | 
			
		||||
					Content: fmt.Sprintf("Mission failed. Cannot send a message to this user: %q", err.Error()),
 | 
			
		||||
					Flags:   discordgo.MessageFlagsEphemeral,
 | 
			
		||||
				})
 | 
			
		||||
@@ -153,7 +153,7 @@ var (
 | 
			
		||||
					panic(err)
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			_, err = s.ChannelMessageSend(
 | 
			
		||||
			_, err = client.ChannelMessageSend(
 | 
			
		||||
				ch.ID,
 | 
			
		||||
				fmt.Sprintf("%s sent you this: https://youtu.be/dQw4w9WgXcQ", i.Member.Mention()),
 | 
			
		||||
			)
 | 
			
		||||
@@ -162,7 +162,7 @@ var (
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		"google-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
 | 
			
		||||
			err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
			err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
				Type: discordgo.InteractionResponseChannelMessageWithSource,
 | 
			
		||||
				Data: &discordgo.InteractionResponseData{
 | 
			
		||||
					Content: searchLink(
 | 
			
		||||
@@ -176,7 +176,7 @@ var (
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		"stackoverflow-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
 | 
			
		||||
			err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
			err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
				Type: discordgo.InteractionResponseChannelMessageWithSource,
 | 
			
		||||
				Data: &discordgo.InteractionResponseData{
 | 
			
		||||
					Content: searchLink(
 | 
			
		||||
@@ -190,7 +190,7 @@ var (
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		"godoc-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
 | 
			
		||||
			err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
			err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
				Type: discordgo.InteractionResponseChannelMessageWithSource,
 | 
			
		||||
				Data: &discordgo.InteractionResponseData{
 | 
			
		||||
					Content: searchLink(
 | 
			
		||||
@@ -204,7 +204,7 @@ var (
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		"discordjs-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
 | 
			
		||||
			err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
			err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
				Type: discordgo.InteractionResponseChannelMessageWithSource,
 | 
			
		||||
				Data: &discordgo.InteractionResponseData{
 | 
			
		||||
					Content: searchLink(
 | 
			
		||||
@@ -218,7 +218,7 @@ var (
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		"discordpy-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) {
 | 
			
		||||
			err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
			err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
 | 
			
		||||
				Type: discordgo.InteractionResponseChannelMessageWithSource,
 | 
			
		||||
				Data: &discordgo.InteractionResponseData{
 | 
			
		||||
					Content: searchLink(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user