zfbx / zdiscord

A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and utilties using discord.js
Other
210 stars 79 forks source link

Creating a Whitelisted command for fivem to use in discord. #75

Closed TreyManCoolKidd closed 2 years ago

TreyManCoolKidd commented 2 years ago

Before submitting your question have you checked the check the FAQ or checked for similar issues already?: [yes/no] yes

Question: Describe your question..

I have been having this issue for a minute, and I want to setup /onduty to a whitelisted command for discord so I can hand out the role instead of making it to where anyone can do /onduty

Information: FiveM artifact #: [eg. 3200] (don't know where to look for that) Using QBCore?: [yes/no] yes When did you last update QBCore if you are using it?: I just downloaded it so I would assume recently around 2 weeks ago? [eg. yesterday, 1 week ago]

zfbx commented 2 years ago

Use exports https://zfbx.github.io/zdiscord/exports#isrolepresent in your /onduty command you'd check if they have the role

-- /onduty command start
local hasRank = exports.zdiscord:isRolePresent(source, "rankRoleId");
if not hasRank then
  return "You don't have the required rank"
end
-- set on duty

-closing since you brought this to the discord