def __init__(self):
		super(ConferenceTimetableBot, self).__init__()
		self.server_params = ServerParameters(savefile_name=SERVER_PARAMS_SAVEFILE_NAME,
											  initial_params=INITIAL_SERVER_PARAMS
											  )
		self.bot = telegramHigh(BOT_TOKEN)
		self.user_params = UserParams(filename="conference_timetable_userparams", initial=INITIAL_SUBSCRIBER_PARAMS)
		self.timetable_db = TimetableDatabase("timetable",self.server_params)

		# starts the main loop
		self.bot.start(processingFunction=self.processUpdate
					, periodicFunction=self.periodicFunction
					# , termination_function=self.termination_function
					)
	def __init__(self):
		super(UploaderBot, self).__init__()
		self.bot = telegramHigh(BOT_TOKEN)
		self.h_subscribers = SubscribersHandler(
				path.join(SCRIPT_FOLDER, "dropbox_photo_uploader_subscribers.save"),
				INITIAL_SUBSCRIBER_PARAMS)
		self.dbx = dropbox.Dropbox(DB_TOKEN)
		self.thread_keep_alive_flag = True  # a flag. When false, the sender thread terminates

		self.uploader_queue = Queue()
		# contains all parameters to be queued to thread that haven't been processed yet.
		self.queue_saver = ListThreadedSaver(filename=path.join(SCRIPT_FOLDER, QUEUE_PARAMS_STORAGE_FILENAME))

		# reload queue
		for param in self.queue_saver.list_generator():
			self.uploader_queue.put(param)

		# starts the main loop
		self.bot.start(processingFunction=self.processUpdate,
					periodicFunction=self.periodicFunction,
					termination_function=self.termination_function
					)
Esempio n. 3
0
    def __init__(self):
        super(UploaderBot, self).__init__()
        self.bot = telegramHigh(BOT_TOKEN)
        self.h_subscribers = SubscribersHandler(
            path.join(SCRIPT_FOLDER,
                      "dropbox_photo_uploader_subscribers.save"),
            INITIAL_SUBSCRIBER_PARAMS)
        self.dbx = dropbox.Dropbox(DB_TOKEN)
        self.thread_keep_alive_flag = True  # a flag. When false, the sender thread terminates

        self.uploader_queue = Queue()
        # contains all parameters to be queued to thread that haven't been processed yet.
        self.queue_saver = ListThreadedSaver(
            filename=path.join(SCRIPT_FOLDER, QUEUE_PARAMS_STORAGE_FILENAME))

        # reload queue
        for param in self.queue_saver.list_generator():
            self.uploader_queue.put(param)

        # starts the main loop
        self.bot.start(processingFunction=self.processUpdate,
                       periodicFunction=self.periodicFunction,
                       termination_function=self.termination_function)
Esempio n. 4
0
#!/usr/bin/python3 -u
# -*- coding: utf-8 -*-

import logging
import telegram
from os import path, makedirs
from random import getrandbits

from telegramHigh import telegramHigh

BOT_TOKEN_FILENAME = "bot_token"
with open(path.join(path.dirname(path.realpath(__file__)), BOT_TOKEN_FILENAME),
          'r') as f:
    BOT_TOKEN = f.read().replace("\n", "")

bot = telegramHigh(BOT_TOKEN)

u = bot.getUpdates()[-1]

chat_id = u.message.chat_id

print("u.message.photo", u.message.photo)

#bot.downloadPhoto(u,custom_filepath='001.tiff')
#!/usr/bin/python3 -u
# -*- coding: utf-8 -*-

import logging
import telegram
from os import path, makedirs
from random import getrandbits

from telegramHigh import telegramHigh

BOT_TOKEN_FILENAME = "bot_token"
with open(path.join(path.dirname(path.realpath(__file__)), BOT_TOKEN_FILENAME),'r') as f:
	BOT_TOKEN = f.read().replace("\n","")

bot = telegramHigh(BOT_TOKEN)

u = bot.getUpdates()[-1]

chat_id = u.message.chat_id

print("u.message.document",u.message.document)
print("u.message.document.file_size",u.message.document.file_size)

# File = bot.bot.getFile(u.message.document['file_id'])
# print("File ",File)
# print("File size ",File["file_size"])

print("bot.getFileExt(u)",bot.getFileExt(u,no_dot=True).lower())
print("bot.getFullPath(u)",bot.getFullPath(u))
print("bot.getFullName(u)",bot.getFullName(u))
print("bot.getURLFileName(u)",bot.getURLFileName(u))