Search code examples
javascriptcommandpatreon

How do I create commands that only people who buy a patreon tier can use?


I need help with how to set up patreon commands to where when somebody buys the tier that is listed they get access to a select amount of commands that only they can use. So basically lets say somebody buys a patreon tier they get access to a command and people who do not buy the tier can not use it, my code is in java script also!


Solution

  • There are many steps to doing that. I don't know any specifics about the Patreon API or your code, but these are the things you'll have to do.

    1. Get the Discord user's email. discord.js extracting emails
    2. Check if the user has the Patreon tier using the Patreon API.
    3. Depending on if they have the tier, change the action.

    This is what I would imagine step 3's code to look like:

    // Message handler
    if (await hasTier(msg.user)) {
      // Do the command
    } else {
      msg.reply("You can't use this command because you don't have the Patreon tier.")
    }
    

    If you want more specific details, please ask individual, specific questions.