mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-20 07:21:38 +01:00
create stable command parser
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Item } from ".";
|
||||
import { sendMessage } from "../commands";
|
||||
import parseCommandArgs from "../lib/parseCommandArgs";
|
||||
import { timeout } from "../lib/timeout";
|
||||
import { User } from "../user";
|
||||
|
||||
@@ -7,8 +8,7 @@ export default new Item('blaster', 'Blaster', 's',
|
||||
'Times a specific person out for 60 seconds',
|
||||
['blaster', 'blast'], ['moderator:manage:banned_users'],
|
||||
async (msg, user) => {
|
||||
const slicecount = msg.messageText.startsWith('!use') ? 2 : 1;
|
||||
const messagequery = msg.messageText.trim().split(' ').slice(slicecount);
|
||||
const messagequery = parseCommandArgs(msg.messageText);
|
||||
if (!messagequery[0]) { await sendMessage('Please specify a target'); return; };
|
||||
const target = await User.initUsername(messagequery[0].toLowerCase());
|
||||
if (!target) { await sendMessage(`${messagequery[0]} doesn't exist`); return; };
|
||||
|
||||
Reference in New Issue
Block a user