Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only ApplicationCommand takes DescriptionLocalizations as a pointer #1555

Open
leonlarsson opened this issue Aug 13, 2024 · 0 comments
Open

Comments

@leonlarsson
Copy link

leonlarsson commented Aug 13, 2024

I am working to port a Discord bot to Go, and I noticed this potential issue.

While building out my slash command data, I noticed that ApplicationCommand is the only struct that takes {Name/Description}Localizations as a pointer. This makes life a little harder as I have a function building this for me. I found this comment on the localization PR: #1143 (comment)

My question is the same as the one above: Why does ApplicationCommand take a pointer while ApplicationCommandOption and ApplicationCommandOptionChoice doesn't?

My current code with the required workaround (assigning a variable):

func GetCommands() []*discordgo.ApplicationCommand {
	// Workaround
	descriptionLocations := localization.BuildDiscordLocalizations("slash_commands/base/bf2042_description")
	return []*discordgo.ApplicationCommand{
		{
			Name:                     "bf2042",
			Description:              localization.GetEnglishString("slash_commands/base/bf2042_description"),
			DescriptionLocalizations: &descriptionLocations,
			Options: []*discordgo.ApplicationCommandOption{
				{
					Name:                     localization.GetEnglishString("slash_commands/stats/name"),
					NameLocalizations:        localization.BuildDiscordLocalizations("slash_commands/stats/name"),
					Description:              localization.GetEnglishString("slash_commands/stats/bf2042_description"),
					DescriptionLocalizations: localization.BuildDiscordLocalizations("slash_commands/stats/bf2042_description"),

Disclaimer: I am very new to Go. I would appreciate the help :)

@leonlarsson leonlarsson changed the title Only ApplicationCommand{} takes DescriptionLocalizations as a pointer Only ApplicationCommand takes DescriptionLocalizations as a pointer Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant