Help us shape the future of Go! Take the 2026 Go Developer Survey

commands

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BassBoost = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "bass-boost",
		Description: "Enables or disables bass boost of the music player.",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionBool{
				OptionName:  "enable",
				Description: "if the bass boost should be enabled or disabled",
				Required:    true,
			},
		},
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel),
	CommandHandler: map[string]dbot.CommandHandler{
		"": bassBoostHandler,
	},
}
View Source
var ClearQueue = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "clear-queue",
		Description: "Removes all songs from your queue.",
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel).And(dbot.HasQueueItems),
	CommandHandler: map[string]dbot.CommandHandler{
		"": clearQueueHandler,
	},
}
View Source
var History = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "history",
		Description: "Shows the current history.",
	},
	Checks: dbot.HasMusicPlayer.And(dbot.HasHistoryItems),
	CommandHandler: map[string]dbot.CommandHandler{
		"": historyHandler,
	},
}
View Source
var LikedSongs = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "liked-songs",
		Description: "Lists/Removes/Plays a liked song.",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "list",
				Description: "Lists all your liked songs.",
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "remove",
				Description: "Removes a liked song.",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionString{
						OptionName:   "song",
						Description:  "The song to remove",
						Required:     true,
						Autocomplete: true,
					},
				},
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "clear",
				Description: "Clears all your liked song.",
			},
		},
	},
	CommandHandler: map[string]dbot.CommandHandler{
		"list":   likedSongsListHandler,
		"remove": likedSongsRemoveHandler,
		"clear":  likedSongsClearHandler,
		"play":   likedSongsPlayHandler,
	},
	AutoCompleteHandler: map[string]dbot.AutocompleteHandler{
		"remove": likedSongAutocompleteHandler,
	},
}
View Source
var Loop = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "loop",
		Description: "Loops your queue.",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionInt{
				OptionName:  "looping-type",
				Description: "how to loop your queue",
				Required:    true,
				Choices: []discord.ApplicationCommandOptionChoiceInt{
					{
						Name:  "Off",
						Value: int(dbot.LoopingTypeOff),
					},
					{
						Name:  "Repeat Song",
						Value: int(dbot.LoopingTypeRepeatSong),
					},
					{
						Name:  "Repeat Queue",
						Value: int(dbot.LoopingTypeRepeatQueue),
					},
				},
			},
		},
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel),
	CommandHandler: map[string]dbot.CommandHandler{
		"": loopHandler,
	},
}
View Source
var Next = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "next",
		Description: "Stops the song and starts the next one.",
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel).And(dbot.HasQueueItems),
	CommandHandler: map[string]dbot.CommandHandler{
		"": nextHandler,
	},
}
View Source
var NowPlaying = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "now-playing",
		Description: "Tells you about the currently playing song.",
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsPlaying),
	CommandHandler: map[string]dbot.CommandHandler{
		"": nowPlayingHandler,
	},
	ComponentHandler: map[string]dbot.ComponentHandler{
		"previous":   previousComponentHandler,
		"play-pause": playPauseComponentHandler,
		"next":       nextComponentHandler,
		"like":       likeComponentHandler,
	},
}
View Source
var Pause = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "pause",
		Description: "Pauses or resumes the music.",
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel),
	CommandHandler: map[string]dbot.CommandHandler{
		"": pauseHandler,
	},
}
View Source
var Play = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "play",
		Description: "Plays music for you.",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionString{
				OptionName:   "query",
				Description:  "song name or url",
				Required:     true,
				Autocomplete: true,
			},
			discord.ApplicationCommandOptionString{
				OptionName:  "search-provider",
				Description: "where to search for the query",
				Choices: []discord.ApplicationCommandOptionChoiceString{
					{
						Name:  "YouTube",
						Value: string(lavalink.SearchTypeYoutube),
					},
					{
						Name:  "YouTube Music",
						Value: string(lavalink.SearchTypeYoutubeMusic),
					},
					{
						Name:  "SoundCloud",
						Value: string(lavalink.SearchTypeSoundCloud),
					},
					{
						Name:  "Spotify",
						Value: "Spotify",
					},
					{
						Name:  "Apple Music",
						Value: "Apple Music",
					},
				},
			},
		},
	},
	Checks: dbot.IsMemberConnectedToVoiceChannel,
	CommandHandler: map[string]dbot.CommandHandler{
		"": playHandler,
	},
	AutoCompleteHandler: map[string]dbot.AutocompleteHandler{
		"": playAutocompleteHandler,
	},
}
View Source
var Previous = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "previous",
		Description: "Stops the song and starts the previous one.",
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel).And(dbot.HasHistoryItems),
	CommandHandler: map[string]dbot.CommandHandler{
		"": previousHandler,
	},
}
View Source
var Queue = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "queue",
		Description: "Shows the current queue.",
	},
	Checks: dbot.HasMusicPlayer.And(dbot.HasQueueItems),
	CommandHandler: map[string]dbot.CommandHandler{
		"": queueHandler,
	},
}
View Source
var Remove = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "remove",
		Description: "Removes songs from the queue.",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "song",
				Description: "Removes a songs from the queue.",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionString{
						OptionName:   "song",
						Description:  "the song to remove",
						Required:     true,
						Autocomplete: true,
					},
				},
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "user-songs",
				Description: "Removes all songs from a user from the queue.",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionUser{
						OptionName:  "user",
						Description: "from which user to remove the songs",
						Required:    true,
					},
				},
			},
		},
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel).And(dbot.HasQueueItems),
	CommandHandler: map[string]dbot.CommandHandler{
		"song":       removeSongHandler,
		"user-songs": removeUserSongsHandler,
	},
	AutoCompleteHandler: map[string]dbot.AutocompleteHandler{
		"song": removeSongAutocompleteHandler,
	},
}
View Source
var Report = dbot.Command{
	Create: discord.MessageCommandCreate{
		CommandName: "report",
	},
	CommandHandler: map[string]dbot.CommandHandler{
		"": reportHandler,
	},
	ComponentHandler: map[string]dbot.ComponentHandler{
		"action":  reportActionHandler,
		"confirm": reportConfirmHandler,
		"delete":  reportDeleteHandler,
	},
	ModalHandler: map[string]dbot.ModalHandler{
		"action-confirm": reportActionConfirmHandler,
	},
}
View Source
var ReportUser = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "report-user",
		Description: "Report a user for breaking the rules.",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionUser{
				OptionName:  "user",
				Description: "The user to report.",
				Required:    true,
			},
			discord.ApplicationCommandOptionString{
				OptionName:  "reason",
				Description: "The reason for the report.",
				Required:    true,
			},
		},
	},
	CommandHandler: map[string]dbot.CommandHandler{
		"": reportUserHandler,
	},
}
View Source
var Reports = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "reports",
		Description: "View/Delete reports of a user.",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "view",
				Description: "View a report of a user.",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionUser{
						OptionName:  "user",
						Description: "The user to view a report of.",
						Required:    true,
					},
					discord.ApplicationCommandOptionInt{
						OptionName:   "report",
						Description:  "The user to view a report of.",
						Required:     true,
						Autocomplete: true,
					},
				},
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "view-all",
				Description: "View all reports of a user.",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionUser{
						OptionName:  "user",
						Description: "The user to view reports of.",
						Required:    true,
					},
				},
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "delete",
				Description: "Delete a reports of a user.",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionUser{
						OptionName:  "user",
						Description: "The user to delete a report of.",
						Required:    true,
					},
					discord.ApplicationCommandOptionInt{
						OptionName:   "report",
						Description:  "The user to view reports of.",
						Required:     true,
						Autocomplete: true,
					},
				},
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "delete-all",
				Description: "Deletes all reports of a user.",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionUser{
						OptionName:  "user",
						Description: "The user to view reports of.",
						Required:    true,
					},
				},
			},
		},
		DefaultMemberPermissions: discord.PermissionKickMembers | discord.PermissionBanMembers | discord.PermissionModerateMembers,
	},
	CommandHandler: map[string]dbot.CommandHandler{
		"view":       reportsViewHandler,
		"view-all":   reportsViewAllHandler,
		"delete":     reportsDeleteHandler,
		"delete-all": reportsDeleteAllHandler,
	},
	AutoCompleteHandler: map[string]dbot.AutocompleteHandler{
		"view":   reportAutocompleteReportHandler,
		"delete": reportAutocompleteReportHandler,
	},
}
View Source
var Seek = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "seek",
		Description: "Seeks the music to a point in the queue.",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionInt{
				OptionName:  "position",
				Description: "the position to seek to in seconds(default)/minutes/hours",
				Required:    true,
				MinValue:    json.NewPtr(0),
			},
			discord.ApplicationCommandOptionInt{
				OptionName:  "time-unit",
				Description: "in which time unit to seek",
				Required:    false,
				Choices: []discord.ApplicationCommandOptionChoiceInt{
					{
						Name:  "Seconds",
						Value: int(lavalink.Second),
					},
					{
						Name:  "Minutes",
						Value: int(lavalink.Minute),
					},
					{
						Name:  "Hours",
						Value: int(lavalink.Hour),
					},
				},
			},
		},
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel),
	CommandHandler: map[string]dbot.CommandHandler{
		"": seekHandler,
	},
}
View Source
var Settings = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "settings",
		Description: "View and edit settings",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "view",
				Description: "View all settings",
			},
			discord.ApplicationCommandOptionSubCommandGroup{
				GroupName:   "moderation",
				Description: "Moderation settings",
				Options: []discord.ApplicationCommandOptionSubCommand{
					{
						CommandName: "disable",
						Description: "Disables moderation",
					},
					{
						CommandName: "log-channel",
						Description: "Set the channel to log moderation actions",
						Options: []discord.ApplicationCommandOption{
							discord.ApplicationCommandOptionChannel{
								OptionName:  "channel",
								Description: "The channel to log moderation actions to",
								Required:    true,
							},
						},
					},
				},
			},
		},
		DefaultMemberPermissions: discord.PermissionManageServer,
	},
	CommandHandler: map[string]dbot.CommandHandler{
		"moderation/disable":     settingsModerationDisableHandler,
		"moderation/log-channel": settingsModerationLogChannelHandler,
	},
}
View Source
var Shuffle = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "shuffle",
		Description: "Shuffles the queue of songs.",
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel).And(dbot.HasQueueItems),
	CommandHandler: map[string]dbot.CommandHandler{
		"": shuffleHandler,
	},
}
View Source
var Stop = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "stop",
		Description: "Stops the playing music.",
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel),
	CommandHandler: map[string]dbot.CommandHandler{
		"": stopHandler,
	},
}
View Source
var Tag = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "tag",
		Description: "lets you display a tag",
		Options: []discord.ApplicationCommandOption{

			discord.ApplicationCommandOptionString{
				OptionName:   "name",
				Description:  "the name of the tag to display",
				Required:     true,
				Autocomplete: true,
			},
		},
	},
	CommandHandler: map[string]dbot.CommandHandler{
		"": tagHandler,
	},
	AutoCompleteHandler: map[string]dbot.AutocompleteHandler{
		"": autoCompleteTagHandler,
	},
}
View Source
var Tags = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "tags",
		Description: "lets you create/delete/edit tags",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "create",
				Description: "lets you create a tag",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionString{
						OptionName:  "name",
						Description: "the name of the tag to create",
						Required:    true,
					},
					discord.ApplicationCommandOptionString{
						OptionName:  "content",
						Description: "the content of the new tag",
						Required:    true,
					},
				},
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "delete",
				Description: "lets you delete a tag",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionString{
						OptionName:  "name",
						Description: "the name of the tag to delete",
						Required:    true,
					},
				},
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "edit",
				Description: "lets you edit a tag",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionString{
						OptionName:  "name",
						Description: "the name of the tag to edit",
						Required:    true,
					},
					discord.ApplicationCommandOptionString{
						OptionName:  "content",
						Description: "the new content of the new tag",
						Required:    true,
					},
				},
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "info",
				Description: "lets you view a tag's info",
				Options: []discord.ApplicationCommandOption{
					discord.ApplicationCommandOptionString{
						OptionName:   "name",
						Description:  "the name of the tag to view",
						Required:     true,
						Autocomplete: true,
					},
				},
			},
			discord.ApplicationCommandOptionSubCommand{
				CommandName: "list",
				Description: "lists all tags",
			},
		},
	},
	CommandHandler: map[string]dbot.CommandHandler{
		"create": createTagHandler,
		"delete": deleteTagHandler,
		"edit":   editTagHandler,
		"info":   infoTagHandler,
		"list":   listTagHandler,
	},
	AutoCompleteHandler: map[string]dbot.AutocompleteHandler{
		"list": autoCompleteTagHandler,
		"info": autoCompleteTagHandler,
	},
}
View Source
var Volume = dbot.Command{
	Create: discord.SlashCommandCreate{
		CommandName: "volume",
		Description: "Changes the volume of the music player.",
		Options: []discord.ApplicationCommandOption{
			discord.ApplicationCommandOptionInt{
				OptionName:  "volume",
				Description: "the desired volume",
				Required:    true,
				MinValue:    json.NewPtr(0),
				MaxValue:    json.NewPtr(100),
			},
		},
	},
	Checks: dbot.HasMusicPlayer.And(dbot.IsMemberConnectedToVoiceChannel),
	CommandHandler: map[string]dbot.CommandHandler{
		"": volumeHandler,
	},
}

Functions

func CreateReport added in v0.3.3

func CreateReport(b *dbot.Bot, settings model.GuildSetting, reportID int32, content string, embed discord.Embed) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL