Skip to content

Instantly share code, notes, and snippets.

@Alasnkz
Last active January 19, 2023 20:04
Show Gist options
  • Save Alasnkz/0a6b8149fe9e29c910a3559552afa891 to your computer and use it in GitHub Desktop.
Save Alasnkz/0a6b8149fe9e29c910a3559552afa891 to your computer and use it in GitHub Desktop.
native DCC_Command:DCC_CreateCommand(const command_name[DCC_COMMAND_SIZE], const description[DCC_COMMAND_DESCRIPTION_SIZE], const callback[], bool:allow_everyone = true, DCC_Guild:guild = DCC_INVALID_GUILD);
native DCC_SendInteractionEmbed(DCC_Interaction:interaction, DCC_Embed:embed, const message[] = "");
native DCC_GetInteractionContent(DCC_Interaction:interaction, dest[], max_size = sizeof dest);
forward GuildCommand(DCC_Interaction:interaction, DCC_User:user);
forward NonGuildCommand(DCC_Interaction:interaction, DCC_User:user);
public OnGameModeInit() {
DCC_CreateCommand("guild", "a guild test command", "GuildCommand", false, DCC_FindGuildById(""));
DCC_CreateCommand("global", "a global test command", "NonGuildCommand");
}
public GuildCommand(DCC_Interaction:interaction, DCC_User:user)
{
new DCC_Embed:embed = DCC_CreateEmbed("Guild command!");
new dest[512];
DCC_GetInteractionContent(interaction, dest);
DCC_SetEmbedColor(embed, 0xFF0000);
DCC_SetEmbedDescription(embed, dest);
DCC_SendInteractionEmbed(interaction, embed, "hi from the guild command :)");
return 1;
}
public NonGuildCommand(DCC_Interaction:interaction, DCC_User:user)
{
new DCC_Embed:embed = DCC_CreateEmbed("Global command!");
new dest[512];
DCC_GetInteractionContent(interaction, dest);
DCC_SetEmbedColor(embed, 0xFF0000);
DCC_SetEmbedDescription(embed, dest);
DCC_SendInteractionEmbed(interaction, embed, "hi from the global command :)");
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment