Skip to content

Commit

Permalink
Merge pull request #413 from DanBot-Hosting/poll-ping
Browse files Browse the repository at this point in the history
feat: poll ping command
  • Loading branch information
wdhdev authored Sep 27, 2023
2 parents c75d1d9 + d53df8f commit 93d6b84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions bot/discord/commands/staff/pollping.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
exports.run = (client, message, args) => {
// Check if user has the dev role
if (!message.member.roles.cache.find((r) => r.id === "898041747597295667")) return;
// Check the message is in the #dev-questions channel
if(message.channel.id !== "1083142107977486389") return message.reply("This command can only be used in <#1083142107977486389>!");
// Command can only be used every 30 minutes
if(pollPingLastUsed + 1800000 > Date.now()) {
message.reply(
`This command can only be used every 30 minutes! Cooldown expires <t:${(pollPingLastUsed + 1800000).toString().slice(0, -3)}:R>`
)
return;
}

message.reply("<@&898041781927682090>");
global.pollPingLastUsed = Date.now();
};
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ global.client = new Discord.Client({
});
global.bot = client;

global.pollPingLastUsed = 0;

require("./bot/discord/commands/mute").init(client);

//Event handler
Expand Down

0 comments on commit 93d6b84

Please sign in to comment.