aboutsummaryrefslogtreecommitdiff
path: root/commands/mod/add.js
diff options
context:
space:
mode:
authorame <[email protected]>2024-04-22 23:46:32 -0500
committerame <[email protected]>2024-04-22 23:46:32 -0500
commit509293de5af9bab66d624fd044e63d8962577af3 (patch)
tree9405af217212020965e68f1c97ff605cddacd2ca /commands/mod/add.js
parent6192af17619bba6066807a383375ba6178636cba (diff)
long time no commit
Diffstat (limited to 'commands/mod/add.js')
-rw-r--r--commands/mod/add.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/commands/mod/add.js b/commands/mod/add.js
new file mode 100644
index 0000000..b9ac0ab
--- /dev/null
+++ b/commands/mod/add.js
@@ -0,0 +1,54 @@
+const fs = require('fs')
+const path = require("path");
+let config_loc = __filename+".json"
+const { PermissionsBitField } = require('discord.js');
+let config = JSON.parse(fs.readFileSync(config_loc))
+const { EmbedBuilder, ActionRowBuilder,ButtonBuilder,ButtonStyle } = require("discord.js");
+const settings = require("../../src/settings")
+
+module.exports = {
+ name : "add",
+ command: ["add"],
+ mod_only: true,
+ config:config,
+ config_loc:config_loc,
+ async main (client,Discord,message,args){
+
+ },
+ s_options:[{type:"sub",name:"button",options:[
+ {type:"string",name:"message",desc:"message id to edit",required:true,autocomplete:false},
+ {type:"string",name:"label",desc:"text on the button",required:true,autocomplete:false},
+ {type:"string",name:"custom-id",desc:"custom id to do custom things",required:true,autocomplete:false},
+ {type:"string",name:"style",desc:"button type",required:true,autocomplete:["Primary","Secondary","Success","Danger","Link"]}
+ ]}],
+ async s_main (client,Discord,interaction){
+ let action = interaction.options.getSubcommand()
+ if(action == "button"){
+ this.exec_button(client, interaction)
+ //await interaction.reply({ content:'sent', ephemeral: true })
+ //interaction.deleteReply()
+ }
+
+
+ },
+
+ async exec_button(client,interaction){
+ interaction.channel.messages.fetch(interaction.options.getString("message"))
+ .then(msg => {
+ if(msg.author.id != "762561860150362142")
+ return interaction.reply({ content:'message must be owned by me', ephemeral: true })
+ const button = new ButtonBuilder()
+ .setCustomId(interaction.options.getString("custom-id"))
+ .setLabel(interaction.options.getString("label"))
+ .setStyle(ButtonStyle[interaction.options.getString("style")])
+
+ const row = new ActionRowBuilder()
+ .addComponents(button);
+
+ msg.edit({components:[row]})
+ interaction.reply({ content:'success', ephemeral: true })
+ }) .catch(e => {
+ interaction.reply({ content:'unable to add anything, are you in the same channel?', ephemeral: true })
+ })
+ },
+} \ No newline at end of file