mirror of
https://github.com/nullnyat/NullcatChan.git
synced 2025-04-29 05:37:19 +09: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…
x
Reference in New Issue
Block a user