mirror of
https://github.com/qwerinope/qweribot.git
synced 2025-12-19 08:41:39 +01:00
added itemlock command, added TNT item, minor bugfixes
This commit is contained in:
13
bot/commands/itemlock.ts
Normal file
13
bot/commands/itemlock.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Command, sendMessage } from ".";
|
||||
import parseCommandArgs from "../lib/parseCommandArgs";
|
||||
import { User } from "../user";
|
||||
|
||||
export default new Command('itemlock', ['itemlock'], 'admin', async msg => {
|
||||
const args = parseCommandArgs(msg.messageText);
|
||||
if (!args[0]) { await sendMessage('Please specify a chatter to toggle the lock for', msg.messageId); return; };
|
||||
const target = await User.initUsername(args[0].toLowerCase());
|
||||
if (!target) { await sendMessage('Targeted user does not exist', msg.messageId); return; };
|
||||
const status = await target.itemLock();
|
||||
status ? await target.clearLock() : await target.setLock();
|
||||
await sendMessage(`Successfully ${status ? 'cleared' : 'set'} the item lock on ${target.displayName}`, msg.messageId);
|
||||
}, false);
|
||||
Reference in New Issue
Block a user