mrbbot / slshx

⚔️ Strongly-typed Discord commands on Cloudflare Workers
MIT License
211 stars 8 forks source link

Implement a few modern Discord API features #16

Open Dougley opened 1 year ago

Dougley commented 1 year ago

This PR will add the following:

useDMPermission()

Similar to useDefaultPermission(), but prevents usage in Direct Messages if false.

Command and command option localization

export function start(): CommandHandler<Env> {
  useDescription("Start a giveaway");
  useLocalizations({
    name: {
      nl: "begin",
    },
    description: {
      nl: "Start een giveaway",
    },
  });
  // or...
  useNameLocalizations({
    nl: "begin",
  })
  useDescriptionLocalizations({
    nl: "Start een giveaway",
  })
  const channel = useChannel("channel", "Channel to hold the giveaway in", {
    types: [ChannelType.GUILD_TEXT],
    required: true,
    localizations: {
      name: {
        nl: "kanaal",
      },
      description: {
        nl: "Kanaal waar de giveaway in wordt gehouden",
      },
    },
  });
// [...]
}

afbeelding

max_length and min_length options to useString()

export function start(): CommandHandler<Env> {
  const prize = useString("prize", "Prize for the giveaway", {
    required: true,
    maxLength: 256,
    minLength: 1,
  });
  // [...]
}

afbeelding

mrbbot commented 1 year ago

Hey! 👋 Thanks for the PR! Will try get this reviewed soon. 😃

JadeMin commented 1 year ago

+1 could you make the NSFW command options too?