Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: poll ping command #413

Merged
merged 5 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
wdhdev marked this conversation as resolved.
Show resolved Hide resolved

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

//Event handler
Expand Down
Loading