Skip to content

Instantly share code, notes, and snippets.

@Denver-sn
Created August 2, 2021 16:21
Show Gist options
  • Save Denver-sn/a141cdbda48d974be738fdc267d54112 to your computer and use it in GitHub Desktop.
Save Denver-sn/a141cdbda48d974be738fdc267d54112 to your computer and use it in GitHub Desktop.
Bot Refill for RR (https://rivalregions.com) | For Ubuntu Server
# First configuration on Ubuntu server #
# 1- install selenium & google & chromedriver
# 2- Upload your file in the server (The bot)
# 3- type crontab -e
# 4 choose the first choice (1)
# 5- Enter 0 */2 * * * python3 /path/where/is/your_file.py
# 6- CTRL + X
# 7- type Enter and it's done!
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# Driver configuration
options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument("user-data-dir=selenium")
driver = webdriver.Chrome(options=options)
def refil_func(): # The refill function
print("Connected to RR")
time.sleep(7)
driver.execute_script("window.open('');")
refil_link = "https://rivalregions.com/parliament/donew/42/0/0"
driver.switch_to.window(driver.window_handles[1])
driver.get(refil_link)
time.sleep(2)
driver.close()
driver.switch_to.window(driver.window_handles[0])
print(f"Refill done!")
print("Initiating AutoRefil bot")
print("Connecting to RR! ")
driver.get("https://rivalregions.com")
try: # try to click login button
time.sleep(3)
connect = driver.find_element_by_xpath("/html/body/div[4]/div[2]/a[1]/div") # You can replace it by the Vk XPATH
connect.click()
EMAIL = "YOUR_EMAIL_OR_NUMBER"
PASS = "YOUR_PASSWORD"
time.sleep(2)
inputEmail = driver.find_element_by_name("email")
inputEmail.send_keys(EMAIL)
print(f"Email entered...")
inputPassword = driver.find_element_by_name("pass")
inputPassword.send_keys(PASS)
print(f"Password entered...")
inputPassword.send_keys(Keys.ENTER)
print(f"Connecting...")
time.sleep(5)
refil_func()
exit()
except: # If the account is already log in then, it refill automatically
print("Already Connected...")
time.sleep(5)
refil_func()
exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment