#๐Ÿ”’ Python help

156 messages ยท Page 1 of 1 (latest)

obsidian garden
#

Hello im new to python and need help. i use visual code studio and trying to make a discord dm bot. this is my script:

import time

# User_ids and header for the account
user_id = [
    1204489908668997734,
    123456789012345678,
    234567890123456789,
    # Add more user IDs here
]
header = {'authorization': 'discord-token-imput'}

# Message content
payload = {
    'content': 'When the video so fire u gotta pull out the 10x combo out'
}

# Send the same direct message from the same account to multiple users, one after another
for user_id in user_ids:
    response = requests.post(f'https://discord.com/channels/@me/{user_id}', json=payload, headers=header)
    if response.status_code == 200:
        print(f'Direct message sent from account {header} to user {user_id}')
    else:
        print(f'Failed to send direct message from account {header} to user {user_id}. Error: {response.status_code}')
    time.sleep(25)

it says it succesfluly sent, but idk, what is wrong here? Am i dumb or what?

formal wingBOT
#

Hey @obsidian garden!

It looks like you pasted Python code without syntax highlighting.

Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
formal wingBOT
#

@obsidian garden

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

obsidian garden
#
import time

# User_ids and header for the account
user_id = [
    1204489908668997734,
    123456789012345678,
    234567890123456789,
    # Add more user IDs here
]
header = {'authorization': 'discord-token-imput'}

# Message content
payload = {
    'content': 'When the video so fire u gotta pull out the 10x combo out'
}

# Send the same direct message from the same account to multiple users, one after another
for user_id in user_ids:
    response = requests.post(f'https://discord.com/channels/@me/{user_id}', json=payload, headers=header)
    if response.status_code == 200:
        print(f'Direct message sent from account {header} to user {user_id}')
    else:
        print(f'Failed to send direct message from account {header} to user {user_id}. Error: {response.status_code}')
    time.sleep(25)```
#

well the link is right

#

idk what im messing up

still hornet
#

I will help you

#

Let me read the code first

obsidian garden
#

ok

still hornet
#

!e ```import requests
import time

User_ids and header for the account

user_id = [
1204489908668997734,
123456789012345678,
234567890123456789,
# Add more user IDs here
]
header = {'authorization': 'discord-token-imput'}

Message content

payload = {
'content': 'When the video so fire u gotta pull out the 10x combo out'
}

Send the same direct message from the same account to multiple users, one after another

for user_id in user_ids:
response = requests.post(f'https://discord.com/channels/@me/{user_id}', json=payload, headers=header)
if response.status_code == 200:
print(f'Direct message sent from account {header} to user {user_id}')
else:
print(f'Failed to send direct message from account {header} to user {user_id}. Error: {response.status_code}')
time.sleep(25)```

formal wingBOT
#

Hey @still hornet!

It looks like you pasted Python code without syntax highlighting.

Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
#

@still hornet :x: Your 3.12 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     import requests
004 | ModuleNotFoundError: No module named 'requests'
still hornet
#

No module named requests?

#

@obsidian garden

obsidian garden
#

what do u mean?e
z

still hornet
#

Like pip install it in ur terminal

obsidian garden
#

lmao whats that

#

oh yes

still hornet
#

Ok ok

obsidian garden
#

i installed pip install requests

#

ik i installed that

still hornet
obsidian garden
#

how

still hornet
#

Should be installed

obsidian garden
#

idk i did do another script without that

#

it was server spam

still hornet
obsidian garden
still hornet
#

You are on vscode right?

obsidian garden
#

u mean this

#

visual studio code

still hornet
#

My wifi is bad

#

Please wait

obsidian garden
#

vscode is visual studio code right?

still hornet
#

Yeah

#

User_ids supposed to be user id?

#

Theres an error

obsidian garden
#

yes

still hornet
#

Fix it then

obsidian garden
still hornet
#

Oh ok

obsidian garden
#

so do i input ur script

#

or?

still hornet
#

I copied ur script to run it

#

!e ```import requests
import time

User_ids and header for the account

user_id = [
1204489908668997734,
123456789012345678,
234567890123456789,
# Add more user IDs here
]
header = {'authorization': 'discord-token-imput'}

Message content

payload = {
'content': 'When the video so fire u gotta pull out the 10x combo out'
}

Send the same direct message from the same account to multiple users, one after another

for user_id in user_ids:
response = requests.post(f'https://discord.com/channels/@me/{user_id}', json=payload, headers=header)
if response.status_code == 200:
print(f'Direct message sent from account {header} to user {user_id}')
else:
print(f'Failed to send direct message from account {header} to user {user_id}. Error: {response.status_code}')
time.sleep(25)```

formal wingBOT
#

Hey @still hornet!

It looks like you pasted Python code without syntax highlighting.

Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
#

@still hornet :x: Your 3.12 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     import requests
004 | ModuleNotFoundError: No module named 'requests'
still hornet
#

See

obsidian garden
#

oh requests is on

#

i have that

#

wait where do i input token?

#

oh found

still hornet
#
import time

# User_ids and header for the account
user_id = [
    1204489908668997734,
    123456789012345678,
    234567890123456789,
    # Add more user IDs here
]
header = {'authorization': 'discord-token-imput'}

# Message content
payload = {
    'content': 'When the video so fire u gotta pull out the 10x combo out'
}

# Send the same direct message from the same account to multiple users, one after another
for user_id in user_ids:
    response = requests.post(f'https://discord.com/channels/@me/{user_id}', json=payload, headers=header)
    if response.status_code == 200:
        print(f'Direct message sent from account {header} to user {user_id}')
    else:
        print(f'Failed to send direct message from account {header} to user {user_id}. Error: {response.status_code}')
    time.sleep(25)```
#

It worked?

obsidian garden
#

wait

#

idk breh

still hornet
#

Did it work?

obsidian garden
#

as u can see no

#

it says it sent, but when i check dms it didint

hallow meadow
#

looks like a selfbot

#

!rule 5

formal wingBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

obsidian garden
#

what is a selfbot

still hornet
obsidian garden
#

its not a bot

#

its my account

still hornet
still hornet
#

You should put a bot token

#

Making this could get you banned from discord

obsidian garden
#

so its illegal?

#

or im dumb

still hornet
#

Yeah dont do it

#

Just dont do it ok?

#

You can put a REAL bot token

obsidian garden
#

not for personal use for client

still hornet
obsidian garden
#

yes client need not me

#

anyway so no help?

still hornet
#

Not ur token

obsidian garden
#

bot token?

#

ooo so bot dms

#

not me

still hornet
#

Exactly

obsidian garden
#

ok

#

wait

still hornet
#

So make the bot dm You

#

For example

obsidian garden
#

whitch token i put

#

secret code?

#

or client

still hornet
#

No

#

No

#

Click reset bot token and copy it

obsidian garden
#

can i say it here

#

or private

still hornet
#

Dont say it here

#

Or even private

#

Someone can log into ur acc from it

obsidian garden
#

oke i cahnged my token to discord bot token

hallow meadow
obsidian garden
#

now what do i do

hallow meadow
#

he will most definetly use it for the selfbot

obsidian garden
still hornet
#

Like for an example

hallow meadow
#

it goes against the rules of the server

obsidian garden
#

yes! train python skills

hallow meadow
#

and its better that u dont help him

obsidian garden
still hornet
still hornet
formal wingBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

obsidian garden
#

its not illegal if we are using a bot

still hornet
#

Sorry You can spam ping other users with it too

#

No knows what You will do

obsidian garden
#

nono, it will be used, if my server has a important announcement the bot will tdm an using from server

hallow meadow
#

i like how everyone who is going against rule 5 only reads out "illegal"

still hornet
#

Ikr?

obsidian garden
still hornet
#

Like itโ€™s jail able

obsidian garden
#

i said what i will use for

still hornet
#

Itโ€™s against the rules

#

Ok?

obsidian garden
#

noo

#

:9

#

:(((

hallow meadow
obsidian garden
#

a bot dming a guy isint illegal

rose barn
#

sussy bio as well

hallow meadow
obsidian garden
#

fuck u niga

rose barn
#

OI

#

language

obsidian garden
obsidian garden
hallow meadow
#

really good

#

u guaranteed a ban

obsidian garden
bold badger
#

!close

formal wingBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.