Ejemplo n.º 1
0
def newStrip(bot, update, args):
    config = readConfig(platform="telegram", profile=args)
    status = createStrip(config)
    if status == 0:
        try:
            strip_file = open(config["saveLocation"] + config["filename"],
                              "rb")
            bot.send_photo(chat_id=update.message.chat_id, photo=strip_file)
            strip_file.close()
        except Exception as err:
            print(err)
    else:
        print("Creation of image failed\n")
        print(status)
Ejemplo n.º 2
0
#!/usr/bin/python3
import tweepy
from randstrip import createStrip, readConfig
import os
import sys

fileDir = os.path.dirname(os.path.abspath(__file__))
fileDir = fileDir + "/"

if __name__ == "__main__":
    if len(sys.argv) == 2:
        altProfile = [sys.argv[1]]
    else:
        altProfile = False
    config = readConfig(platform="twitter", profile=altProfile)
    status = createStrip(config)
    if status == 0:
        with open(config["token"]) as f:
            tokens = f.readlines()
        tokens = [x.strip() for x in tokens]
        auth = tweepy.OAuthHandler(tokens[0], tokens[1])
        auth.set_access_token(tokens[2], tokens[3])
        api = tweepy.API(auth)
        published = False
        for i in range(0, 100):
            try:
                api.verify_credentials()
                api.update_with_media(
                    config["saveLocation"] + config["filename"],
                    config["text"])
                published = True
Ejemplo n.º 3
0
fileDir = os.path.dirname(os.path.abspath(__file__))
fileDir = fileDir + "/"


def newStrip(bot, update, args):
    config = readConfig(platform="telegram", profile=args)
    status = createStrip(config)
    if status == 0:
        try:
            strip_file = open(config["saveLocation"] + config["filename"],
                              "rb")
            bot.send_photo(chat_id=update.message.chat_id, photo=strip_file)
            strip_file.close()
        except Exception as err:
            print(err)
    else:
        print("Creation of image failed\n")
        print(status)


if __name__ == "__main__":
    config = readConfig(platform="telegram")
    with open(config["token"]) as token_file:
        content = token_file.readlines()
    token = content[0].strip()
    updater = Updater(token)
    dp = updater.dispatcher
    dp.add_handler(CommandHandler('strip', newStrip, pass_args=True))
    updater.start_polling()
    updater.idle()
Ejemplo n.º 4
0
#!/usr/bin/python3
from randstrip import createStrip, readConfig
from mastodon import Mastodon
import os
import sys

fileDir = os.path.dirname(os.path.abspath(__file__))
fileDir = fileDir + "/"
API_URL = "https://botsin.space"

if __name__ == "__main__":
    if len(sys.argv) == 2:
        altProfile = [sys.argv[1]]
    else:
        altProfile = False
    config = readConfig(platform="mastodon", profile=altProfile)

    with open(config["token"]) as f:
        createapp = f.readlines()
    createapp = [x.strip() for x in createapp]
    TOKEN = createapp[0]
    mastodon = Mastodon(access_token=TOKEN, api_base_url=API_URL)
    status = createStrip(config)
    if status == 0:
        published = False
        for i in range(1, 100):
            try:
                new_strip = mastodon.media_post(
                    config["saveLocation"] + config["filename"], "image/png")
                mastodon.status_post(config["text"], media_ids=new_strip)
                published = True