Beispiel #1
0
import botbase
import time

TARGET = -1
BOT = botbase.BotBase()


def main():
    last_update_id = None
    while True:
        updates = BOT.get_updates(last_update_id)
        if len(updates["result"]) > 0:
            last_update_id = BOT.get_last_update_id(updates) + 1
            forward(updates)
        time.sleep(0.5)


if __name__ == '__main__':
    main()


def forward(updates):
    for update in updates:
        BOT.send_forward(update["message"]["message_id"],
                         update["message"]["message_id"], TARGET)
Beispiel #2
0
import imutils
import cv2
import botbase
import json 
import requests
import threading
from PIL import ImageFont, ImageDraw, Image  


CAMERA_RES =(1920, 1088)
view_info = (False, 0, 0)
file = open("token.txt")
TOKEN = file.read().strip()
file.close()
URL = "https://api.telegram.org/bot{}/".format(TOKEN)
BOT = botbase.BotBase(URL)

def view_leaderboard(start = 0):
    lead = open("leaderboard.txt","r")
    line = lead.readline()
    stats = json.loads(line)
    lead.close()
    sorted = []
    for key in stats:
        if str(key) == "650557855":
            stats[key][0] = 68
        sorted += [(stats[key][0], stats[key][1], key)]
    sorted.sort()
    sorted.reverse()
    i = 0
    returner = "<b>O A T S   Leaderboard:</b>\n"
Beispiel #3
0
import botbase
import time
# lrt = open("LRT","r")
# token = lrt.readline().strip()
token = "688427290:AAGDtkCK6KVQnY4DXED8sy5zG5imojkOpQI"
BOT = botbase.BotBase("https://api.telegram.org/bot{}/".format(token))

def main():
    last_update_id = None
    while True:
        updates = BOT.get_updates(last_update_id)
        if len(updates["result"]) > 0:
            last_update_id = BOT.get_last_update_id(updates) + 1
            respond(updates)
        time.sleep(0.5)

def respond(updates):
    print("Responding")
    for update in updates["result"]:
        try:
            message = update["message"]
            print(message)
            # BOT.send_forward(message["message_id"], message["chat"]["id"], )
        except Exception as e:
            print("Error: {}".format(e))
            pass
            # BOT.send_message("There was an error ({}) forwarding this message: {}".format(e, message), -286832243)

if __name__ == "__main__":
    main()
Beispiel #4
0
import botbase
import time

BOT = botbase.BotBase(
    "https://api.telegram.org/bot672157411:AAFdc-pkC-K2QGLwOIPVhpIoWZxKbx4eQ9g/"
)


def main():
    last_update_id = None
    while True:
        updates = BOT.get_updates(last_update_id)
        if len(updates["result"]) > 0:
            last_update_id = BOT.get_last_update_id(updates) + 1
            respond(updates)
        time.sleep(0.5)


def respond(updates):
    for update in updates["result"]:
        try:
            message = update["message"]
            if (message["chat"]["id"] == -1001290963588):
                BOT.send_forward(message["message_id"], message["chat"]["id"],
                                 -1001290963588)
        except Exception as e:
            BOT.send_message(
                "There was an error ({}) forwarding this message: {}".format(
                    e, message), -1001290963588)
        pass
Beispiel #5
0
##############################

import json, time, urllib, requests, botbase
from PIL import Image
from random import randint
from math import ceil
from io import BytesIO

# Image.getpixel(xy)

QUIT = False

file = open("data/token.txt")
TOKEN = file.read().strip()
file.close()
BOT = botbase.BotBase(TOKEN)


def get_main_chat():
    file = open("data/chat_id.txt")
    num = int(file.read().strip())
    file.close
    return num


CHESS_CHAT = get_main_chat()

help_message = "<b>Commands:</b>\n/newgame:\n    Send in a request for a new game.\n/leaderboard:\n    View the different leaderboards.\n/viewgames:\n    View any currently active games.\n/replay:\n    Allows you to watch old games.\n/help:\n    H M M S T  idk what this does.\n\n<b>Gameplay:</b>\nOnce a game starts you take your move by replying to the message sent to your dms. The move positions use the grid given on the image.\n    Move EX: a3 to a5\nIf your message is not formatted like this it will not work (A3 to A5 is still valid)."

checkers = ("⬜", "⬛")
tileset = {
Beispiel #6
0
import os
import sys
from inspect import getsourcefile
is_debug = False
for arg in sys.argv:
    if arg == '-d':
        is_debug = True
path = os.path.abspath(getsourcefile(lambda: 0))[:-11]
sys.path.insert(0, path + 'src')
sys.path.insert(0, path + 'plugins')
sys.path.insert(0, path + 'templates')
sys.path.insert(0, path + 'apps')
os.chdir(path + 'src')

import botbase

bot = botbase.BotBase(is_debug)
try:
    bot._start_(1)
except Exception as e:
    bot.sender.send(
        bot.keys.admin_id,
        'Exception in unknown place:\n' + str(type(e)) + '\n' + str(e))