mirror of
https://github.com/syuilo/ai.git
synced 2024-11-25 06:01:07 +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);
|
return ('0000000000' + num).slice(-length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const titles = ['さん', 'くん', '君', 'ちゃん', '様', '先生'];
|
||||||
|
|
||||||
|
const invalidChars = ['@', '#', '*', ':', '(', '[', ' ', ' '];
|
||||||
|
|
||||||
export default class CoreModule implements IModule {
|
export default class CoreModule implements IModule {
|
||||||
public name = 'core';
|
public name = 'core';
|
||||||
private ai: 藍;
|
private ai: 藍;
|
||||||
|
@ -81,13 +85,11 @@ export default class CoreModule implements IModule {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.includes('@')) {
|
if (invalidChars.some(c => name.includes(c))) {
|
||||||
msg.reply(serifs.core.invalidName);
|
msg.reply(serifs.core.invalidName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const titles = ['さん', 'くん', '君', 'ちゃん', '様', '先生'];
|
|
||||||
|
|
||||||
const withSan = titles.some(t => name.endsWith(t));
|
const withSan = titles.some(t => name.endsWith(t));
|
||||||
|
|
||||||
if (withSan) {
|
if (withSan) {
|
||||||
|
|
Loading…
Reference in a new issue