Add /send
This commit is contained in:
parent
beff32bb38
commit
71f9be9f42
1 changed files with 29 additions and 1 deletions
30
index.js
30
index.js
|
@ -1,6 +1,7 @@
|
||||||
const dc = require("discord.js");
|
const dc = require("discord.js");
|
||||||
const client = new dc.Client({intents: ["GUILDS", "GUILD_MESSAGES"]});
|
const client = new dc.Client({intents: ["GUILDS", "GUILD_MESSAGES"]});
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
const allowed = ["831598877320413244"];
|
||||||
|
|
||||||
function isDir(path){
|
function isDir(path){
|
||||||
try{
|
try{
|
||||||
|
@ -68,6 +69,23 @@ client.on("ready", () => {
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "send",
|
||||||
|
description: "Sends a message in specificed channel or current channel.",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: "message",
|
||||||
|
description: "What to send?",
|
||||||
|
type: 3,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "channel",
|
||||||
|
description: "Where to send?",
|
||||||
|
type: 7
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
@ -116,6 +134,17 @@ client.on("interactionCreate", (int) => {
|
||||||
embed.setDescription("And the games continue, this game is currently on tie, press a button to continue.");
|
embed.setDescription("And the games continue, this game is currently on tie, press a button to continue.");
|
||||||
}
|
}
|
||||||
int.reply({embeds: [embed], components: [msgRow]});
|
int.reply({embeds: [embed], components: [msgRow]});
|
||||||
|
} else if(int.commandName == "send"){
|
||||||
|
if(!allowed.includes(int.user.id)) return int.reply({content: "You don't have permissions to use this command.", ephemeral: true});
|
||||||
|
var channel = int.options.getChannel("channel") || int.channel;
|
||||||
|
var message = int.options.getString("message");
|
||||||
|
int.deferReply();
|
||||||
|
channel.send(message).then(msg => {
|
||||||
|
int.reply({content: "Successfully sent message.", ephemeral: true});
|
||||||
|
}).catch(e => {
|
||||||
|
int.reply({content: "An error has occured, check console."});
|
||||||
|
console.log(e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if(int.isButton()){
|
} else if(int.isButton()){
|
||||||
console.log("Button detected");
|
console.log("Button detected");
|
||||||
|
@ -171,7 +200,6 @@ function doStuff(msg, cmd){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const allowed = ["831598877320413244"];
|
|
||||||
client.on("messageCreate", (msg) => {
|
client.on("messageCreate", (msg) => {
|
||||||
if(msg.content.startsWith("rps!ev")){
|
if(msg.content.startsWith("rps!ev")){
|
||||||
if(!allowed.includes(msg.author.id)) return msg.channel.send("Nu perms!");
|
if(!allowed.includes(msg.author.id)) return msg.channel.send("Nu perms!");
|
||||||
|
|
Loading…
Reference in a new issue