aboutsummaryrefslogtreecommitdiff
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/util/defaults/ping.js.json2
-rw-r--r--commands/util/ping.js39
2 files changed, 41 insertions, 0 deletions
diff --git a/commands/util/defaults/ping.js.json b/commands/util/defaults/ping.js.json
new file mode 100644
index 0000000..f390c76
--- /dev/null
+++ b/commands/util/defaults/ping.js.json
@@ -0,0 +1,2 @@
+{"cooldown":3,"desc":"get ping!","restrict":[],"restricted":[],
+"usage":"{command}"} \ No newline at end of file
diff --git a/commands/util/ping.js b/commands/util/ping.js
new file mode 100644
index 0000000..7908c54
--- /dev/null
+++ b/commands/util/ping.js
@@ -0,0 +1,39 @@
+const fs = require('fs')
+const path = require("path");
+let config_loc = __filename+".json"
+const { EmbedBuilder } = require("discord.js");
+let settings = require("../../src/settings")
+
+//get config located at ./ping.js.json (edit in ./defaults/ping.js.json, then run sh buildconfig.sh)
+let config = JSON.parse(fs.readFileSync(config_loc))
+module.exports = {
+ //name used in /help command, or command when used in slash commands
+ name : "ping",
+ //aliases a command can be called by (only used in non-slash commands)
+ command: ["ping"],
+ mod_only: false,
+ //link config
+ config:config,
+ config_loc:config_loc,
+
+ //main function called when using old commands
+ async main (client,Discord,message,args){
+ return await this.exec(client,{message:message})
+ },
+
+ //slash command w/ options, a slash command wont appear unless a s_main exists
+ s_options:[{type:"string",name:"test",desc:"example",required:false,autocomplete:false}],
+ async s_main (client,Discord,interaction){
+ return await this.exec(client,{message:interaction})
+ },
+
+ //common function to be called by both main and s_main (just my preference)
+ async exec(client,info){
+ let time = Date.now() - info.message.createdTimestamp
+ let embed = new EmbedBuilder()
+ .setTitle("Pong!")
+ .setDescription(time + "ms")
+ .setColor(settings.defaultColor)
+ return info.message.reply({embeds : [embed], ephemeral: true })
+ }
+} \ No newline at end of file