mirror of
https://github.com/sern-handler/tools
synced 2026-06-06 01:16:59 +00:00
Merge pull request #11 from Peter-MJ-Parker/patch-4
refactor: more clear errors for descriptions
This commit is contained in:
@@ -18,11 +18,16 @@ const intoApplicationType = (type: number) =>
|
||||
type === 3 ? 1 : Math.log2(type);
|
||||
|
||||
const makeDescription = (type: number, desc: string) => {
|
||||
if (type !== CommandType.Text && desc !== '') {
|
||||
console.warn('Found context menu that has non empty description field. Implictly publishing with empty description');
|
||||
return '';
|
||||
}
|
||||
return desc;
|
||||
if ((type == CommandType.Slash || type == CommandType.Both) && (!desc || desc.length === 0)) {
|
||||
throw new Error('Found application command that has no description field or is empty.');
|
||||
}
|
||||
if ((type == CommandType.CtxMsg || type == CommandType.CtxUser) && desc.length > 0) {
|
||||
console.warn(
|
||||
'Found context menu that has non empty description field. Implictly publishing with empty description.'
|
||||
);
|
||||
return '';
|
||||
}
|
||||
return desc;
|
||||
};
|
||||
|
||||
const serializePerms = (perms: unknown) => {
|
||||
|
||||
Reference in New Issue
Block a user