You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
2.2 KiB
41 lines
2.2 KiB
4 years ago
|
const Discord = require('discord.js');
|
||
|
|
||
4 years ago
|
const UserData = require('../../models/user');
|
||
4 years ago
|
|
||
4 years ago
|
const {TagFilter} = require('../../util/tagfilter');
|
||
|
const {Tag} = require('../../util/tag');
|
||
4 years ago
|
|
||
4 years ago
|
module.exports = {
|
||
|
name: "setstatus",
|
||
|
aliases: ['sst'],
|
||
|
meta: {
|
||
4 years ago
|
category: 'Developer',
|
||
|
description: "Set my public status. Don't make me say something weird! (Also only available to devs, of course.)",
|
||
|
syntax: '`setstatus <-s status> <-t type>`',
|
||
|
extra: "You can check if a user is an admin without being a developer."
|
||
4 years ago
|
},
|
||
|
tags: [],
|
||
|
help: new Discord.MessageEmbed()
|
||
|
.setTitle("Help -> Status-Setting")
|
||
|
.setDescription("Sets the bot's status")
|
||
4 years ago
|
.addField("Syntax", "`setstatus <-s status> <-t type>`")
|
||
4 years ago
|
.addField('Notice', "This command is **developer-only**"),
|
||
|
async execute(message, msg, args, cmd, prefix, mention, client) {
|
||
4 years ago
|
if (!args.length) {return message.channel.send(`Syntax: \`${prefix}setstatus <-s status> <-t type>\``);}
|
||
4 years ago
|
let tu = await UserData.findOne({uid: message.author.id});
|
||
|
if (!tu || !tu.developer) {return message.channel.send("You must be a Natsuki developer in order to do that!");}
|
||
4 years ago
|
|
||
|
let options = new TagFilter([
|
||
|
new Tag(['s', 'status', 'm', 'msg', 'message'], 'status', 'append'),
|
||
|
new Tag(['t', 'type'], 'type', 'append')
|
||
|
]).test(args.join(" "));
|
||
4 years ago
|
if (!options.status || !options.status.length) {return message.channel.send("You must use the -status tag (and -type if you want a custom type)!");}
|
||
4 years ago
|
|
||
|
if (options.status.length > 30) {return message.reply("That status is a bit too long.");}
|
||
4 years ago
|
if (options.type) {if (!['playing', 'watching', 'listening'].includes(options.type.toLowerCase())) {return message.channel.send("That's not a valid type!");}}
|
||
4 years ago
|
|
||
4 years ago
|
if (options.type) {client.user.setActivity(options.status, {type: options.type.toUpperCase()});}
|
||
|
else {client.user.setActivity(options.status);}
|
||
|
return message.channel.send(`Status set to: \`${options.type ? `${options.type.slice(0, 1).toUpperCase()}${options.type.slice(1).toLowerCase()}${options.type && options.type.toLowerCase() == 'listening'} ` ? 'to ' : '' : ''}${options.status}\`.`);
|
||
4 years ago
|
}
|
||
|
};
|