toOpenAIMessages: Add fallback to use user id on empty resolved name
Previously if someone named whose current mechanism resolved to empty string ("Джо" for example) then the openai would scream that the name does not match their server side regex. Meaning that the bot could not be used in a given channel until that person changes it's display name or it will be forgotten for the bot.
This commit is contained in:
parent
ffa79e798e
commit
b7f6a5fe91
1 changed files with 2 additions and 1 deletions
|
@ -88,7 +88,8 @@ function getAuthorUsername(message: DiscordMessage): string | undefined {
|
||||||
if (name.length >= 3) return name;
|
if (name.length >= 3) return name;
|
||||||
}
|
}
|
||||||
const name = formatName(message.author.username);
|
const name = formatName(message.author.username);
|
||||||
return name;
|
if (name.length > 0) return name;
|
||||||
|
return message.author.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue