mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
I'm not very smart
This commit is contained in:
@@ -12,11 +12,11 @@ module.exports = class TagAddCommand extends Command {
|
|||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'id',
|
key: 'name',
|
||||||
prompt: 'What should the ID of the tag be?',
|
prompt: 'What should the name of the tag be?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
max: 50,
|
max: 50,
|
||||||
parse: id => id.toLowerCase()
|
parse: name => name.toLowerCase()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'text',
|
key: 'text',
|
||||||
@@ -28,15 +28,15 @@ module.exports = class TagAddCommand extends Command {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { id, text }) {
|
async run(msg, { name, text }) {
|
||||||
const tag = await Tag.findOne({ where: { id, guildID: msg.guild.id } });
|
const tag = await Tag.findOne({ where: { name, guildID: msg.guild.id } });
|
||||||
if (tag) return msg.reply(`A tag with the ID **${id}** already exists.`);
|
if (tag) return msg.reply(`A tag with the name **${name}** already exists.`);
|
||||||
await Tag.create({
|
await Tag.create({
|
||||||
userID: msg.author.id,
|
userID: msg.author.id,
|
||||||
guildID: msg.guild.id,
|
guildID: msg.guild.id,
|
||||||
id,
|
name,
|
||||||
text
|
text
|
||||||
});
|
});
|
||||||
return msg.reply(`Added the tag **${id}**.`);
|
return msg.reply(`Added **${name}**.`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ module.exports = class TagEditCommand extends Command {
|
|||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'id',
|
key: 'name',
|
||||||
prompt: 'What is the ID of the tag you want to edit?',
|
prompt: 'What is the name of the tag you want to edit?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
max: 50,
|
max: 50,
|
||||||
parse: id => id.toLowerCase()
|
parse: name => name.toLowerCase()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'text',
|
key: 'text',
|
||||||
@@ -28,13 +28,13 @@ module.exports = class TagEditCommand extends Command {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { id, text }) {
|
async run(msg, { name, text }) {
|
||||||
const tag = await Tag.findOne({ where: { id, guildID: msg.guild.id } });
|
const tag = await Tag.findOne({ where: { name, guildID: msg.guild.id } });
|
||||||
if (!tag) return msg.reply(`A tag with the ID **${id}** doesn't exist.`);
|
if (!tag) return msg.reply(`A tag with the name **${name}** doesn't exist.`);
|
||||||
if (!msg.channel.permissionsFor(msg.author).has('MANAGE_MESSAGES') && tag.userID !== msg.author.id) {
|
if (!msg.channel.permissionsFor(msg.author).has('MANAGE_MESSAGES') && tag.userID !== msg.author.id) {
|
||||||
return msg.reply('You can only edit your own tags.');
|
return msg.reply('You can only edit your own tags.');
|
||||||
}
|
}
|
||||||
await Tag.update({ text }, { where: { id, guild: msg.guild.id } });
|
await Tag.update({ text }, { where: { name, guild: msg.guild.id } });
|
||||||
return msg.reply(`Edited the tag **${id}**.`);
|
return msg.reply(`Edited **${name}**.`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,19 +13,19 @@ module.exports = class TagInfoCommand extends Command {
|
|||||||
clientPermissions: ['EMBED_LINKS'],
|
clientPermissions: ['EMBED_LINKS'],
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'id',
|
key: 'name',
|
||||||
prompt: 'What is the ID of the tag you want to get information on?',
|
prompt: 'What is the name of the tag you want to get information on?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
max: 50,
|
max: 50,
|
||||||
parse: id => id.toLowerCase()
|
parse: name => name.toLowerCase()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { id }) {
|
async run(msg, { name }) {
|
||||||
const tag = await Tag.findOne({ where: { id, guildID: msg.guild.id } });
|
const tag = await Tag.findOne({ where: { name, guildID: msg.guild.id } });
|
||||||
if (!tag) return msg.reply(`A tag with the ID **${id}** doesn't exist.`);
|
if (!tag) return msg.reply(`A tag with the name **${name}** doesn't exist.`);
|
||||||
let author;
|
let author;
|
||||||
try {
|
try {
|
||||||
const authorUser = await this.client.users.fetch(tag.userID);
|
const authorUser = await this.client.users.fetch(tag.userID);
|
||||||
@@ -36,7 +36,7 @@ module.exports = class TagInfoCommand extends Command {
|
|||||||
const embed = new MessageEmbed()
|
const embed = new MessageEmbed()
|
||||||
.setColor(0x00AE86)
|
.setColor(0x00AE86)
|
||||||
.setThumbnail(msg.guild.iconURL())
|
.setThumbnail(msg.guild.iconURL())
|
||||||
.addField('❯ ID', tag.id, true)
|
.addField('❯ name', tag.name, true)
|
||||||
.addField('❯ Author', author, true)
|
.addField('❯ Author', author, true)
|
||||||
.addField('❯ Created On', new Date(tag.createdAt).toDateString(), true)
|
.addField('❯ Created On', new Date(tag.createdAt).toDateString(), true)
|
||||||
.addField('❯ Modified On', new Date(tag.updatedAt).toDateString(), true);
|
.addField('❯ Modified On', new Date(tag.updatedAt).toDateString(), true);
|
||||||
|
|||||||
@@ -12,23 +12,23 @@ module.exports = class TagRemoveCommand extends Command {
|
|||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'id',
|
key: 'name',
|
||||||
prompt: 'What is the ID of the tag you want to remove?',
|
prompt: 'What is the name of the tag you want to remove?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
max: 50,
|
max: 50,
|
||||||
parse: id => id.toLowerCase()
|
parse: name => name.toLowerCase()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { id }) {
|
async run(msg, { name }) {
|
||||||
const tag = await Tag.findOne({ where: { id, guildID: msg.guild.id } });
|
const tag = await Tag.findOne({ where: { name, guildID: msg.guild.id } });
|
||||||
if (!tag) return msg.reply(`A tag with the ID **${id}** doesn't exist.`);
|
if (!tag) return msg.reply(`A tag with the name **${name}** doesn't exist.`);
|
||||||
if (!msg.channel.permissionsFor(msg.author).has('MANAGE_MESSAGES') && tag.userID !== msg.author.id) {
|
if (!msg.channel.permissionsFor(msg.author).has('MANAGE_MESSAGES') && tag.userID !== msg.author.id) {
|
||||||
return msg.reply('You can only delete your own tags.');
|
return msg.reply('You can only delete your own tags.');
|
||||||
}
|
}
|
||||||
await tag.destroy();
|
await tag.destroy();
|
||||||
return msg.reply(`Removed the tag **${id}**.`);
|
return msg.reply(`Removed **${name}**.`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,19 +11,19 @@ module.exports = class TagSourceCommand extends Command {
|
|||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'id',
|
key: 'name',
|
||||||
prompt: 'What is the ID of the tag you want view the source of?',
|
prompt: 'What is the name of the tag you want view the source of?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
max: 50,
|
max: 50,
|
||||||
parse: id => id.toLowerCase()
|
parse: name => name.toLowerCase()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { id }) {
|
async run(msg, { name }) {
|
||||||
const tag = await Tag.findOne({ where: { id, guildID: msg.guild.id } });
|
const tag = await Tag.findOne({ where: { name, guildID: msg.guild.id } });
|
||||||
if (!tag) return msg.reply(`A tag with the ID **${id}** doesn't exist.`);
|
if (!tag) return msg.reply(`A tag with the name **${name}** doesn't exist.`);
|
||||||
return msg.code('md', tag.text);
|
return msg.code('md', tag.text);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,19 +11,19 @@ module.exports = class TagCommand extends Command {
|
|||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
args: [
|
args: [
|
||||||
{
|
{
|
||||||
key: 'id',
|
key: 'name',
|
||||||
prompt: 'What is the ID of the tag you want view?',
|
prompt: 'What is the name of the tag you want view?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
max: 50,
|
max: 50,
|
||||||
parse: id => id.toLowerCase()
|
parse: name => name.toLowerCase()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { id }) {
|
async run(msg, { name }) {
|
||||||
const tag = await Tag.findOne({ where: { id, guildID: msg.guild.id } });
|
const tag = await Tag.findOne({ where: { name, guildID: msg.guild.id } });
|
||||||
if (!tag) return msg.reply(`A tag with the ID **${id}** doesn't exist.`);
|
if (!tag) return msg.reply(`A tag with the name **${name}** doesn't exist.`);
|
||||||
return msg.say(tag.text);
|
return msg.say(tag.text);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ const Tag = Database.db.define('tag', {
|
|||||||
type: Sequelize.STRING,
|
type: Sequelize.STRING,
|
||||||
allowNull: false
|
allowNull: false
|
||||||
},
|
},
|
||||||
id: {
|
name: {
|
||||||
type: Sequelize.STRING,
|
type: Sequelize.STRING,
|
||||||
allowNull: false
|
allowNull: false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user