Im having errors while making a bot

Viewed 28

So uh I have this python code, and it „generates“ an output. (After the if stuff) Im trying to redirect this to a discord channel via a bot or webhook, but everything I tried hasn‘t worked yet. Do you have any idea how to do it?

import threading
import time
import random
 
# How many threads the program is gonna run | The more threads the more internet and pc resources are needed.
threads = 50
# Determines the ID range that will be scanned - Default is 6000000 - 7800000
minrange = 6000000
maxrange = 7800000
# -----------------------
group_ids = [*range(minrange, maxrange)]
 
random.shuffle(group_ids)
popped_groups = group_ids
 
results = open('results.txt', 'w')
results.close()
 
i = 0
 
 
def groupthingy():
    current_group = popped_groups.pop()
 
    try:
        group = requests.get(
            f'https://groups.roblox.com/v1/groups/{current_group}')
        json = group.json()
        if '"isLocked":true' not in group.text:
            if json['owner'] == None:
                if json['publicEntryAllowed'] == True:
                    results = open('results.txt', 'a')
                    results.write(f"Group: {current_group} is claimable!\n")
                    results.close()
 
    except Exception:
        pass
 
 
groupthreads = []
for gk in range(threads):
    lt = threading.Thread(target=groupthingy)
    groupthreads.append(lt)
    lt.start()
    time.sleep(0.00000000001)```
1 Answers

You should look into how bots work via the Official discord py documentation. You will need to download some libraries, create a discord app and then create a bot. Then you will receive a token to identify your bot to discord, you will also be able to generate a link to invite your bot to a server you own or a server in which you can invite bots.

First you will need to get the channel via get to fetch the Guild object from the guild_id you hardcode, and then get the channels in that guild via the channel_id you hardcode. Once you found the channel you want, you can call the coroutine send on the channel you want with parameter content= followed by the string you want to send to the discord server

Related