mirror of
https://github.com/syuilo/ai.git
synced 2024-12-22 08:21:08 +00:00
Better validation
This commit is contained in:
parent
238016b11c
commit
2289ea5437
|
@ -9,6 +9,10 @@ function zeroPadding(num: number, length: number): string {
|
|||
return ('0000000000' + num).slice(-length);
|
||||
}
|
||||
|
||||
const titles = ['さん', 'くん', '君', 'ちゃん', '様', '先生'];
|
||||
|
||||
const invalidChars = ['@', '#', '*', ':', '(', '[', ' ', ' '];
|
||||
|
||||
export default class CoreModule implements IModule {
|
||||
public name = 'core';
|
||||
private ai: 藍;
|
||||
|
@ -81,13 +85,11 @@ export default class CoreModule implements IModule {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (name.includes('@')) {
|
||||
if (invalidChars.some(c => name.includes(c))) {
|
||||
msg.reply(serifs.core.invalidName);
|
||||
return true;
|
||||
}
|
||||
|
||||
const titles = ['さん', 'くん', '君', 'ちゃん', '様', '先生'];
|
||||
|
||||
const withSan = titles.some(t => name.endsWith(t));
|
||||
|
||||
if (withSan) {
|
||||
|
|
Loading…
Reference in a new issue