Python discord bot to check all users for a specific role that also HAVE a specific role

  discord, discord.py, python

OK, so I’m writing my first Discord bot in python, and I’m having trouble looking up how to do this exactly. I’m going to write what I need it to do in a combination of python, visual basic commands ( because I know those better than python ) and simple English, so as to give a better idea of what I’m trying to accomplish.

Just to note, this python bot is running on my PC, not a hosted. And it is only in one (my) discord server.

@client.command()
async def team1(ctx):
     await ctx.send('Sending Inactivity Report For Team1')

#Here's where I combine languages just to show what I'm trying to do

users = (Every member in server)

For each users
     if user has joined in 21 days or less then
          goto skip
     end if

     if user has role "Absent With Notice" then
          goto skip
     end if
     if user has role "Team1" then
          if user does NOT have role "Active" then
               await ctx.send('User is inactive and should be warned.')
          end if
     end if
skip:
next users

Any ideas on where to begin? Any help would be awesome. 🙂

Source: Python Questions

LEAVE A COMMENT