2
votes

So i have seen another post with almost the exact same question however, mine is different.

I am fully aware there is a Patreon bot, however to my knowledge this is only valid on servers.

So lets say someone invites my bot, and tries a command that requires them to be a patron. How could my bot written in python do a check to see if they have become a patron for my product? And then set a role for them accordingly. Which i can then do the check on to allow them access to the command or not.

So essentially, it should do what the Patreon bot does, however would work on its own. Examples are such as the Dank Memer bot: which can be invited to any server and if one becomes a patron can use specific commands, otherwise you can't

I've looked around this topic for a while now and haven't been able to find any info on how to check if the user has become a patron or not.

Many thanks in advance!

3

3 Answers

0
votes

There is a way out, but its probably not the right one, so, If you know who your patreons are and you know their discord IDs as well, you can declare an if statement in the command similar to this -

@client.command()
async def your_command_name():
    if member.id == #Your 1st Patreon's Discord ID:
        #Your Code 
    elif member.id == #Your 2nd Patreon's Discord ID:
        #Your code
    else:
        await ctx.send("You cannot use that command as you are not a patreon!")

But again this is probably not right way if you have a lot of patreons or you dont know their Discord IDs, but anyways this way was the only way I could come up with. I hope that helped. :)

0
votes

If you know the patreons. just give them a role [patreons] or any name! after giving them the role. copy the role id and paste it in patreons_role_id

ok, what this command does is, just it check for the [patreons] role in the member roles! if the [patreons] role is present! it will execute the #your code else it sends a custom message!

@client.event()
async def on_message(message):
    if message.content == '!test':
        is_patreon = False
        for user_roles in message.author.roles:
            if user_roles.id == patreons_role_id:
                is_patreon = True
                break
        if is_patreon == True:#your code
        else: await message.channel.send('THIS COMMAND IS ONLY AVAILABLE FOR PATREON!')
0
votes

Let's assume you have a role for your patreons.

@client.command()
@commands.has_roles("PatreonRole")
async def commandname(ctx, args):
    #do stuff