'Can't skip to next member when sending DM's discord.py
So, here is the code:
client = discord.Client()
token = input(f"\n{Color.BLUE} > {Color.WHITE} Enter your token: ")
@client.event
async def on_ready():
print(f"\n{Color.GREEN} > {Color.WHITE} Logged in as: {client.user.name}")
server_id = int(input(f"\n{Color.BLUE} > {Color.WHITE} Enter Server ID: "))
message = input(f"\n{Color.BLUE} > {Color.WHITE} Enter message: ")
# get how many members are in server
members = client.get_guild(server_id).members
member_count = len(members)
for i in range(member_count):
for member in client.get_guild(server_id).members:
# if it's the client, skip and send it to the next member
if member.id == client.user.id:
# skip to next member
continue
# send message to member
await member.send(message)
print(f"\n{Color.GREEN} > {Color.WHITE} Done!\n")
In the list, the client is first, and it tries to send it to the client, but it obviusly can't. The client is not a bot, it's a normal discord account (selfbot). Any ideas? thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
