join discord server selenium with tokens python

Viewed 511

I would like to create a bot that enters a discord account via a token, and enters a discord server by entering the invitation code. I would like to repeat this action indefinitely, creating new chrome pages and logging in with different tokens. is there a simpler and shorter way to do this? I can give more informations if needed

from selenium import webdriver
import time
from selenium.webdriver.common.action_chains import ActionChains

token1="here my first token"
invite_link = input("Enter the invite link: ")

driver1 = webdriver.Chrome("C:\Chromedriver.exe")
driver1.maximize_window()
time.sleep(5)
driver1.get('https://discord.com/login')
time.sleep(10)
driver1.execute_script('window.t = "' + token1 + '";window.localStorage = document.body.appendChild(document.createElement `iframe`).contentWindow.localStorage;window.setInterval(() => window.localStorage.token = `"${window.t}"`); window.location.reload();')
time.sleep(4)
driver1.find_element_by_xpath("/html/body/div[1]/div[2]/div/div[2]/div/div/nav/ul/div[2]/div[4]").click()
time.sleep(2)
driver1.find_element_by_xpath("/html/body/div[1]/div[4]/div[2]/div/div/div/div/div/div/div[3]/button").click()
time.sleep(1)
actions = ActionChains(driver1)
actions.send_keys(invite_link)
actions.perform()
time.sleep(1)
driver1.find_element_by_xpath("/html/body/div[1]/div[4]/div[2]/div/div/div/div/div/div/div/div[3]/button[1]").click()
print("Entered with token1")


0 Answers
Related