Exemplo n.º 1
0
def get_sudo_message(message):
    if message == "sudo gtu":
        response = user_database.get_total_users()
    elif message == "sudo gu":
        response = user_database.get_users()
    elif message == "sudo status":
        response = "Hey! botvid is working great! :)"
    else:
        response = "unrecognized admin command"
    return response
Exemplo n.º 2
0
def send_message():
    now = datetime.now()
    counter_mins = now.minute
    if (counter_mins == 59):
        for users in user_database.get_users():
            botvid.send_message(users, botvid.get_message())
            botvid.send_message(users, Alert1)
            botvid.send_message(users, Alert2)

    print("Sent automated update message to all users")
Exemplo n.º 3
0
def get_sudo_message(message):
    if message == "sudo gtu":
        # 1) "sudo gtu" -> get total numbers of users from database
        response = user_database.get_total_users()
    elif message == "sudo gu":
        # 2) "sudo gu" -> return list of user_ids from database
        response = user_database.get_users()
    elif message == "sudo status":
        # 3) "sudo status" -> Is the bot working?
        response = "Hey, Roshan! BOTVID-19 is working great! :)"
    else:
        response = "unrecognized admin command"
    return response
Exemplo n.º 4
0
def send_message():
    now = datetime.now()
    mins = now.minute
    hours = now.hour
    if ((hours % 2 == 0 and (hours > 6 and hours < 24))
            and (mins == 12 or mins == 13)):
        for users in user_database.get_users():
            botvid.send_message(users, botvid.get_message())
            botvid.send_message(users, Alert1)
            botvid.send_message(users, Alert2)
            print("Sent automated update message to user: "******" at ",
                  now)

    print("Database updated at: ", now)
Exemplo n.º 5
0
def send_message():
    for users in user_database.get_users():
        botvid.send_message(users, botvid.get_response())
        botvid.send_message(users, DISCLAIMER)
    print("Sent automated update message to all users")
Exemplo n.º 6
0
import sys
import user_database, state_database, scrape

try:
    command = sys.argv[1]
    if command != "":
        if command == "get_total_users()":
            print("Total users: ", user_database.get_total_users())
        elif command == "get_users()":
            print("Following is the user list:")
            for users in user_database.get_users():
                print(users)
        elif command == "get_update_data()":
            print(state_database.get_tabulated_data())
        elif command == "get_all_state_data()":
            print(state_database.get_all_state_data())
        elif command == "help":
            print("* get_total_users() : prints total users in the database\n")
            print("* get_users() : prints a list of users in the database\n")
            print(
                "* get_update_data(): prints the current data to be sent to users\n"
            )
            print(
                "* get_all_state_data(): prints everything stored in state database\n"
            )
            print("* help: prints all available commandline inputs")
        else:
            print("* Sorry, the command you asked for is not listed\n")
            print("* use 'help' to get a list of available commands\n")
except:
    print("* This script is used for checking database contents\n")