add /me command
This commit is contained in:
2 files changed
+66
-3
No files matched your search
@@ -0,0 +1,55 @@
|
|||||||
|
const { MessageEmbed } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "me",
|
||||||
|
description: "Send a message stating your characters action",
|
||||||
|
usage: "[action]",
|
||||||
|
permissions: {
|
||||||
|
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||||
|
member: [],
|
||||||
|
},
|
||||||
|
aliases: ["action", "do"],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
SlashCommand: {
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: "action",
|
||||||
|
description: "Message to state your action",
|
||||||
|
value: "action",
|
||||||
|
type: 3,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||||
|
* @param {import("discord.js").MessageCreate} message
|
||||||
|
* @param {string[]} args
|
||||||
|
* @param {*} param3
|
||||||
|
*/
|
||||||
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||||
|
return interaction.send(`You are not allowed to use the bot in this channel.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const actionEmbed = new MessageEmbed()
|
||||||
|
.setColor(client.config.EmbedColor)
|
||||||
|
.setTitle('Action Performed')
|
||||||
|
.setDescription(`<@${interaction.member.user.id}> - *${args[0].value}*`)
|
||||||
|
.setTimestamp()
|
||||||
|
|
||||||
|
if (client.exists(GuildDB.actionChannel)) {
|
||||||
|
const channel = interaction.guild.channels.cache.find(channel => channel.id === GuildDB.actionChannel);
|
||||||
|
return channel.send({ embeds: [actionEmbed] });
|
||||||
|
} else {
|
||||||
|
return interaction.send({ embeds: [actionEmbed] });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
+11
-3
@@ -116,8 +116,8 @@ class QuarksBot extends Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async GetGuild(GuildId) {
|
async GetGuild(GuildId) {
|
||||||
let customChannelStatus;
|
let customChannelStatus, allowedChannels;
|
||||||
let allowedChannels;
|
let actionChannel, tweetChannel;
|
||||||
let guild = await this.dbo.collection("guilds").findOne({"server.serverID":GuildId}).then(guild => guild);
|
let guild = await this.dbo.collection("guilds").findOne({"server.serverID":GuildId}).then(guild => guild);
|
||||||
|
|
||||||
// If guild not found, generate guild default
|
// If guild not found, generate guild default
|
||||||
@@ -126,6 +126,8 @@ class QuarksBot extends Client {
|
|||||||
server: {
|
server: {
|
||||||
serverID: GuildId,
|
serverID: GuildId,
|
||||||
hasCustomChannels: false,
|
hasCustomChannels: false,
|
||||||
|
actionChannel: null,
|
||||||
|
tweetChannel: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.dbo.collection("guilds").insertOne(newGuild, function(err, res) {
|
this.dbo.collection("guilds").insertOne(newGuild, function(err, res) {
|
||||||
@@ -133,15 +135,21 @@ class QuarksBot extends Client {
|
|||||||
});
|
});
|
||||||
customChannelStatus = newGuild.server.hasCustomChannels;
|
customChannelStatus = newGuild.server.hasCustomChannels;
|
||||||
allowedChannels = null;
|
allowedChannels = null;
|
||||||
|
actionChannel = null;
|
||||||
|
tweetChannel = null;
|
||||||
} else {
|
} else {
|
||||||
customChannelStatus = guild.server.hasCustomChannels;
|
customChannelStatus = guild.server.hasCustomChannels;
|
||||||
if (guild.server.allowedChannels!=undefined||guild.server.allowedChannels!=null&&guild.server.allowedChannels.length>0) {
|
actionChannel = guild.server.actionChannel;
|
||||||
|
tweetChannel = guild.server.tweetChannel;
|
||||||
|
if (this.exists(guild.server.allowedChannels) && guild.server.allowedChannels.length>0) {
|
||||||
allowedChannels = guild.server.allowedChannels;
|
allowedChannels = guild.server.allowedChannels;
|
||||||
} else allowedChannels = null;
|
} else allowedChannels = null;
|
||||||
}
|
}
|
||||||
let guildData = {
|
let guildData = {
|
||||||
allowedChannels: allowedChannels,
|
allowedChannels: allowedChannels,
|
||||||
customChannelStatus: customChannelStatus,
|
customChannelStatus: customChannelStatus,
|
||||||
|
actionChannel: actionChannel,
|
||||||
|
tweetChannel: tweetChannel,
|
||||||
serverID: GuildId
|
serverID: GuildId
|
||||||
}
|
}
|
||||||
return guildData;
|
return guildData;
|
||||||
|
|||||||
Reference in new issue
Block a user