Exemple #1
0
    def __init__(self, config):
        self.config = config
        self.db = database.Database(self.config)

        self.bot = botogram.create(config["telegram_token"])
        self.bot.lang = "it"
        self.bot.owner = config["owner"]
        self.bot.about = "Ricevi gli orari scolastici e gli avvisi dal sito " + utils.shorten_url(
            config["school_website"])
        self.bot.after_help = [
            "Sai programmare?",
            "<a href=\"https://github.com/paolobarbolini/TelegramSchoolBot\">Questo bot è opensource!</a>",
        ]
        self.bot.link_preview_in_help = False

        self.bot.use(commands.Commands(self.db))
        self.bot.use(tasks.Tasks(self.config, self.db))
Exemple #2
0
YEAR_CHOICES = {
    "1st": ["first", "one", "1", "1st"],
    "2nd": ["second", "two", "2", "2nd"],
    "3rd": ["third", "three", "3", "3rd"],
    "4th": ["fourth", "four", "4", "4th"],
}
LANG_CHOICES = {
    1: "Python 2/3",
    2: "C++",
    4: "C",
    8: "Java",
}

my_handle = "YOUR_HANDLE"

bot = botogram.create("YOUR_TELEGRAM_API_TOKEN")
bot.about = """
	Welcome to CSEC-CPD registration bot.
	You can use this bot to register for CSEC-CPD membership."""
bot.owner = my_handle


class memory:
    def __init__(self):
        self.names = {}
        self.ids = {}
        self.genders = {}
        self.emails = {}
        self.phone_nums = {}
        self.years = {}
        self.langs = {}
Exemple #3
0
from scraper import scrape
import json

import config

import botogram

import jellyfish

bot = botogram.create(config.BOT_TOKEN)

ls = json.load(open('last_scrape.json', 'r'))
stats = scrape()

for news in stats['news']:
    abort = False
    if news not in ls['news']:
        for n in ls['news']:
            if jellyfish.jaro_distance(news, n) > 0.9:
                abort = True
        if abort:
            continue
        bot.chat(config.CHANNEL_ID) \
            .send(f"тЪая╕П {news.lstrip().rstrip()}\n\nЁЯФЧ By @CoronaVirusOfficialNews", syntax='html')

json.dump({**ls, 'news': stats['news']}, open('last_scrape.json', 'w'))
Exemple #4
0
import botogram
import rpgModular
import charter

bot = botogram.create("KEY")

@bot.command("start")
def start(chat, message):
    chat.send("Welcome to the Nexus of Memoirs. Please /login")
@bot.command("login")
def login(chat, message):
    messageParsed = message.text[7:]
    character = rpgModular.CharacterExist(messageParsed)
    if character.fail == 1:
        chat.send("No such character")
    elif character.fail == 0:
        output = character.showStats()
        output2 = character.showSkills()
        chat.send(str(output))
        chat.send(str(output2))
if __name__ == "__main__":
    bot.run()
import Buffer_operation as bo
import botogram
import pickle

bot = botogram.create("731472091:AAGGqOJK_HEmYxpuHwMKwyZw25rJ9bLIThU")
bot.about = '''This is a bot created for Sending the values from Sensors and to detect whether the washroom is clean or not'''

bot.owner = '''@KuroAkuma'''

bot.after_help = [
    """This bot is capable of fetching the realtime data with command /getData, more features will be coming in future. Feel free to ping Aeres on Freenode irc servers, [not on bouncer anymore tho, if not found worry not]. mostly hangs around in #anime, ##anime. @KuroAkuma is the telegram[keeps changing and hard to track]. 
        Mail: [email protected] [replies within a week!]
        """
]

primary_sent = {"Gas Sensor": "", "LDRSensor": "", "Usage Count": ""}
primary_gasbuffer = []
primary_ldrbuffer = []
primary_pc = []


@bot.command("greetMe")
def greetMe_command(chat, message, args):
    """Says hello world to the person whose name is provided"""
    test_str = "Konichiwa"
    test_str_2 = "Senpai, watashi Anata no jujun'na shimo be"
    if len(args) > 0:
        test_str += " " + args[0]
        test_str += test_str_2
    else:
        test_str += " " + test_str_2
Exemple #6
0
import botogram

import conf
import db

bot = botogram.create(conf.api_token)


@bot.command("add")
def add_command(chat, message, args):
    """Add url for check"""

    if len(args) == 1:
        db.add_url(chat.id, args[0])
        chat.send("Ok")

    else:
        chat.send("Enter valid url")


@bot.command("remove")
def remove_command(chat, message, args):
    """Remove url from check"""

    if len(args) == 1:
        db.remove_url(chat.id, args[0])
        chat.send("Ok")

    else:
        chat.send("Enter valid url")
Exemple #7
0
import botogram
import requests
import time
from datetime import datetime
from urllib.request import urlopen
from wakeonlan import wol

import sport
import apiKey
import altriCom

keyBot = apiKey.apiBot()

bot = botogram.create(keyBot)
bot.about = "Questo è il bot di Infopz\nUtilizza l'opzione /help per ottenere un elenco di tutti i comandi e delle possibili opzioni"
bot.owner = "@infopz"


@bot.command("hello", hidden=True)
def hello_command(chat, message, args):
    '''Ciaone!
       \nTi saluta con un bel ciao'''
    control(message)
    chat.send("Hello World")


#SERIEA COMMANDS
@bot.command('seriea')
def seriea_command(chat, message, args, shared):
    '''Visualizza Partite e Classifica Serie A
    \nOpzioni:
import API
import botogram
from datetime import datetime
import sqlite3

bot = botogram.create("TOKEN")

conn = sqlite3.connect('MinecraftBot.db')
c = conn.cursor()

try:
    c.execute('''CREATE TABLE users(userid INTEGER)''')
except:
    pass

@bot.command("start")
def start(chat, message, args):
    """Welcome!"""
    message.reply("*Welcome!*"+\
        "\n*Thanks* you very much for starting *me*!"+\
        "\n*How use me*? Do /help!"+
        "\nDo you need more *help*? Contact me! @MarcoBuster")

    c.execute('''DELETE FROM users WHERE userid=?''',(message.sender.id,))
    c.execute('''INSERT INTO users VALUES(?)''',(message.sender.id,))
    conn.commit()

@bot.command("viewusers")
def viewusers(chat, message, args):
    """View the list and the count of users"""
    if message.sender.id != 26170256: #Only admin command
import botogram
from wfreader24hr import *
from wfreader2hr import *
from wfutility import readAPIKey, extractDateTime
from wfgeolocation import wfGeolocation

bot = botogram.create(readAPIKey("telegram"))


def sg_general_forecast():
    weather_forecast_reader = Weather24hrForecastReader()

    weather_forecast_reader.read()

    forecast_dic = weather_forecast_reader.getForecast()

    forecast = "Latest 24 hr Weather for Singapore:"

    datetime = extractDateTime(forecast_dic.get('Timestamp')).split("T")

    forecast += "\nGeneral Forecast(As Of {}):".format(datetime[1])
    forecast += "\nForecast: {}".format(forecast_dic.get('Forecast'))
    forecast += "\nHumidity: {} {}".format(forecast_dic.get('Humidity'), "%")
    forecast += "\nTemperature: {} {}".format(forecast_dic.get('Temperature'),
                                              u"\u2103")
    forecast += "\nWind Speed: {} {}".format(forecast_dic.get('Windspeed'),
                                             "km/h")
    forecast += "\nWind Direction: {}".format(
        forecast_dic.get('Winddirection'))

    forecast += "\n\nRegion Specific Forecast:"
Exemple #10
0
import botogram
import sqlite3
import config, utils
from objects import messages, callbacks, commands

conn = sqlite3.connect(config.DATABASE_FILE_NAME + '.db')
c = conn.cursor()
bot = botogram.create(config.API_TOKEN)

if config.FIRST_START:
    utils.first_start()


@bot.command("start")
def start(chat, message):
    commands.start(chat, message)


@bot.callback("informazioni")
def informazioni(query, message):
    callbacks.informazioni(query, message, "it")


bot._components[0]._Component__no_commands = []
bot._main_component._add_no_commands_hook(messages.command_not_found)
if __name__ == '__main__':
    bot.run()
SOFTWARE.
"""
import json

from source.objects.config_parser import ConfigParser
# configuration parser to get telegram info

from botogram import create, Buttons as BButtons
# Get botogram.create to save the username of the bot and
# Get a botogram.Buttons class and save it as BButtons

from typing import Union, List
# Needed for parameters and return hints

config = ConfigParser("data/configs/config.json")
bot = create(config.telegram.BOT_TOKEN)
# todo new config
bot_username = bot.itself.username
del bot, create


class _Category:
    """prende il nome del tipo della categoria #todo eng.

    Attributes
    ----------
    lang : str
        The lang of the message text


    json_lang : dict
Exemple #12
0
'''LICENSED WITH APACHE 2.0'''
# IMPORTANT: CHANGE ALL ELEMENTS WITH '$'
# REMEMBER THAT YOU HAVE TO CHANGE ALSO THE JSON FILE
# Set your password, Set your Api token

import botogram
import sqlite3
import os
import time
from obj.start import r, d, dat, logch
from obj.jsonr import p
from obj.visualizers import visualizer, staffvis, verdict
from obj.checks import checklink, check2, knowit, checkperm
bot = botogram.create(p["values"]["token"])
# Set your api token in the json file (data/lang.json)$
bot.owner = "@Mamiglia & https://github.com/Mamiglia/Requester-Bot"
# Set yourself as the owner$

d.execute("SELECT id FROM ids WHERE type=3")
x = d.fetchone()
if x is not None:
    bot.chat(int(x[0])).send('Admins, press /refreshpin!')


def checkreq(cht, typ):
    '''Check if the user can make a request, the users can have only one request at time'''
    if int(r.get('door')) > 0:
        try:
            d.execute("INSERT INTO request (userid, type) VALUES (?,?)",
                      (cht.id, typ))
            dat.commit()
Exemple #13
0
import botogram
from datetime import datetime
import json
import re
import time
import threading
import requests
import sys
import subprocess
import socket

bot = botogram.create('441586309:AAGfrlV7RniRRSrn9rUlSkriqvvEajXBVt4')
status = {0: 'Alive', 1: 'Dead', 2: "No connection to internet"}
ports = {
    22: 'ssh',
    80: 'http',
    443: 'https',
    23: 'telnet',
    21: 'ftp',
    25: 'smtp',
    110: 'pop3',
    143: 'impap'
}
userLock = threading.Lock()


class Host:
    def __init__(self, ip, nickname, state=1):
        self.ip = ip
        self.state = state
        self.nickname = nickname
Exemple #14
0
#!/bin/env python3
from quoter import replaceWords
import botogram
bot = botogram.create("your api key here")
bot.owner = "KeiTachikawa on telegram, aeres99[at]gmail.com"
bot.after_help = [
    "This bot simply gives new random quotes.",
]


@bot.command("hello")
def hello_command(chat, message, args):
    """This basically says hello, and tells about the bot. Its goal and purpose"""
    chat.send(
        "Hello, I am linux quotes bot. Please note none of these quotes are real, they are made for fun and no cute animals were harmed in its creation"
    )


@bot.command("new")
def new_command(chat, message, args):
    """Send in the new random quote!"""
    output_quote = replaceWords()
    print("*" * 10)
    print(output_quote)
    chat.send(output_quote)


if __name__ == "__main__":
    bot.run()
Exemple #15
0
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import time
import datetime
import botogram
import os

bot_token = os.environ.get("PEI_BOT_TOKEN")
staff_chat_id = os.environ.get("PEI_STAFF_CHAT_ID")

if not bot_token or not staff_chat_id:
    print("Config unavailable.")

bot = botogram.create(bot_token)


@bot.command("info")
def hello_command(chat, message, args):
    """Welcome to Telegram File System
    """
    btns = botogram.Buttons()
    # btns[0].callback("Prenota un appuntamento", "prenota")
    # chat.send("Benvenuto al Pei - chat.id: " + str(chat.id), attach=btns)
    chat.send("chat_id: " + str(chat.id))


@bot.command("start")
def hello_command(chat, message, args):
    """Welcome to Pei Support Bot
    """
Exemple #16
0
import botogram  # <python3> -m pip install botogram2

token = input('Please insert your Telegram bot token from t.me/BotFather: ')
bot = botogram.create(token)

@bot.before_processing
def any_message(chat):
    chat.send("GitHub is for everyone!")
    return True

if __name__ == '__main__':
    bot.run()

import botogram, os, sqlite3, gettext

bot = botogram.create(os.environ['BOT'])
bot.about = "A nHentai's (unofficial) bot"
bot.owner = "@Bestfast"


@bot.command("start")
def start_command(chat, message, args):
    """Start the bot"""

    conn = sqlite3.connect('users.db')
    c = conn.cursor()

    try:
        c.execute("SELECT user_id FROM users WHERE user_id = ?",
                  (message.sender.id, ))

    except sqlite3.OperationalError:
        return lang(chat, message)

    data = c.fetchall()

    if not data:

        conn.close()
        return lang(chat, message)
    else:
        _ = getlang(message.sender.id)
        btns = botogram.Buttons()
        btns[0].url(_("Open a pull request"),
Exemple #18
0
        "id": str,
        "from": botogram.User,
        "query": str,
        "offset": str,
    }
    optional = {
        "location": botogram.Location,
    }
    replace_keys = {
        "from": "sender"
    }

botogram.Update.optional["callback_query"] = CallbackQuery
botogram.Update.optional["inline_query"] = InlineQuery

bot = botogram.create(config.BOT_TOKEN)


@bot.command("start")
def start(message, args):
    """Avvia il bot"""
    if args:
        deeplinking.process_deeplinking(bot, message, args)
        return

    commands.process_start_command(bot, message)


@bot.command("admin", hidden=True)
def admin(message):
    commands.process_admin_command(bot, message)
Exemple #19
0
import botogram
bot = botogram.create("AQUI VA EL TOKEN DEL BOT")
bot.owner = "linguini"


@bot.command("spam")
def spam_command(chat, message, args):

    for i in range(10000):
        chat.send("*PON TU MENSAJE AQUI*")


if __name__ == "__main__":
    bot.run()
Exemple #20
0
import json
from buspy.checker_builder import build_checker
from buspy.datetime_helpers import gettime
from buspy.bots.explain_arrivals import explain

rel_path = "../buspy/tokens.json"
with open(rel_path) as f:
    tokens = json.load(f)

import botogram
bot = botogram.create(tokens["telegram"])

subscriptions = []


@bot.command("hello")
def hello_command(chat, message, args):
    """Welcome to buspy. I can help you to find and send reminder when the next bus is coming!"""
    chat.send(
        "Welcome to buspy. I can help you to find and send reminder when the next bus is coming"
    )


def clean_message(message):
    return message.replace('<text>', '').replace('</text>', '')


def check_and_send_message(chat, checker):
    result = checker.time_to_be_at_bus_stop()
    can_use_result = (result.within_range
                      or (result.outside_range
from datetime import datetime as dt, timedelta
import re

import botogram
import yaml
import requests

import database as db

config = yaml.safe_load(open('config.yml'))

blip_blop_explanation = 'https://gitlab.com/etica-digitale/gruppo-telegram/-'\
        '/blob/master/Redirect-Spiegazione.md'

# bot information
bot = botogram.create(config.get('token'))
bot.about = "This bot is used to block a flooder with a captcha"
bot.owner = "@sonomichelequellostrano"

# antiflood config
antiflood_config = config.get('antiflood_config')

# emoji list for captcha
emojis = config.get('emojis')

# list of privacy friend Youtube player
ytinstances = config.get('ytinstances')


# delete message with replaced links if clicked by original sender
@bot.callback("delete_message")
Exemple #22
0
"""
    Demo
    ====

    user: 
        /hello
    bot: 
        What's up bitch
"""

import botogram
from input import *

bot = botogram.create(API_key)


@bot.command("hello")
def hello_command(chat, message, args):
    """Say hello to the world!"""
    chat.send("What's up bitch")


if __name__ == "__main__":
    bot.run()
Exemple #23
0
import botogram
import hashlib
import os
import time
import re
import random
import argparse
import sys
from instabot import Bot
import requests
import datetime
import matplotlib.pyplot as plt
bot = botogram.create("your token")


def loadList(file, type):
    if type == "int":
        with open(file, "r") as file:
            list = [int(line.rstrip("\n")) for line in file]
    else:
        with open(file, "r") as file:
            list = [line.rstrip("\n") for line in file]
    return list


def writeList(file, list):
    with open(file, "w+") as file:
        for item in list:
            file.write(str(item) + "\n")

Exemple #24
0
import requests
import botogram
import datetime
from src import config

bot = botogram.create(config.token_tg)
bot.owner = "@ch3p4ll3"


def convert_time(strr):
    strr = strr.replace("Z", "")
    a = strr.split(":")
    h = str(int(a[0]) + 1)
    return h + ":" + a[1] + ":" + a[2]


def control_year(year):
    url = "http://ergast.com/api/f1/{}".format(year)

    r = requests.get(url)

    if r.status_code == 200:
        return year
    else:
        return "current"


def diffdate(data, f):
    datetime_format = '%d/%m/%Y %H:%M:%S'
    now = datetime.datetime.now()
    date1 = data + " " + f
Exemple #25
0
import botogram
import requests

bot = botogram.create('376118437:AAEIPV1YVQmgEhELB8Q3NOJ1tiDd50m2xTY')
#url = "https://api.telegram.org/bot376118437:AAHGUTat7yo67cQEKNweuWoVHPkjiCswfbk/"


@bot.command("hello")
def hello_command(chat, message, args):
    """Say hello to the world!"""
    chat.send("Hello world")


@bot.command("myaf")
def myaf_command(chat, message, args):
    """Say hello to the world!"""
    chat.send("Kot kot")


if __name__ == "__main__":
    bot.run()
Exemple #26
0
from decouple import config
import botogram
import pymongo
from pymongo import MongoClient
import re

bot = botogram.create(config("API_KEY"))
bot.about = config("about")
bot.owner = config("owner")

client = MongoClient()
db = client.vpnbotdb
users = db.users


@bot.command("start")
def add_user(chat, message, args):
    """
    Just a simple start
    """
    new_user = {
        "chat_id": chat.id,
        "username": chat.username,
        "first_name": chat.first_name,
        "last_name": chat.last_name,
        "months": 1,
        "this_month": True
    }
    try:
        users.insert_one(new_user)
        send_msg_to_admin('{} just started the bot'.format(
Exemple #27
0
import botogram
import redis
import random
from datetime import datetime as dt, timedelta

# bot information
bot = botogram.create("BOT_TOKEN")
bot.about = "This bot is used to block a flooder with a captcha"
bot.owner = "@sonomichelequellostrano"

# redis
r = redis.Redis()

# antiflood config
antiflood_config = {"messaggi": 3, "secondi": 4}

# emoji list for captcha
emojis = {
    "grinning_face": {
        "emoji": "😀",
        "description": "faccia sorridente"
    },
    "face_with_tears_of_joy": {
        "emoji": "😂",
        "description": "faccia con lacrime di gioia"
    },
    "upside_down_face": {
        "emoji": "🙃",
        "description": "faccia sotto sopra"
    }
}
Exemple #28
0
import botogram
bot = botogram.create("YOUR API KEY")
bot.owner = "BOT OWNER"

@bot.command("spam")
def spam_command(chat, message, args):
    """Spam For big Groups!
    This command send the word "spam" using the markdown syntaxis
    """ 
    for i in range (Number):
        chat.send("*SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM SPAM*")
       

if __name__ == "__main__":
    bot.run()
Exemple #29
0
# Copyright (c) 2020 Hearot
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from environs import Env

import botogram

env = Env()
env.read_env()

bot = botogram.create(env.str("BOT_TOKEN", default=""))

del botogram, env, Env
Exemple #30
0
from random import randint
from nhentai import Nhentai
import botogram

bot = botogram.create("TOKEN")


@bot.command("search")
def search_command(chat, message, args):
    if not args:
        chat.send("Command usage: `/search <ID>`")
    else:
        try:
            if Nhentai().book_info(int(args[0]))["title"]:
                chat.send("https://nhentai.net/g/" + str(args[0]))
                if (int(args[0]) == 177013):
                    chat.send(
                        "God damn it, I can't believe you're really doing this."
                    )
        except KeyError:
            chat.send("404 Not Found")
        except ValueError:
            chat.send("Invalid data")


@bot.command("latest")
def latest_command(chat, message, args):
    chat.send("https://nhentai.net/g/" + str(Nhentai().latest_id()))


@bot.command("random")
Exemple #31
0
    if path.exists(a):
       try:
         validyaml = yaml.safe_load(a)
       except ValueError as e:
         return False
       return True


"""
Prestart
"""

log = logbook.Logger("botogram bot")
log.info("Starting...")
log.info("Preflight check...")
bot = botogram.create(check_env("TGTOKEN"))

parser = argparse.ArgumentParser("tg2")
parser.add_argument("configfile", help="Configuration file", type=str)
args = parser.parse_args()
if check_file_arg(args.configfile):
    cmdlist = configfileload(args.configfile)

"""
Base commands
"""


@bot.command("version")
def version_command(chat, message, args):
    """Bot version and link"""
Exemple #32
0
import botogram
import parser
import redis
import conf

bot = botogram.create("")
r = redis.Redis(host=conf.HOST, port=conf.PORT, password=conf.PASS)

r.set(bot.itself.id, "INIT")


@bot.command("start")
def start(chat):
    chat.send("benvenuto")
    return r.set(chat.id, "START")


@bot.command("cerca")
def search_command(chat):
    print(r.get(chat.id))
    if r.get(chat.id) == "INIT":
        chat.send("Usare il comando /start per iniziare")
        return
    chat.send("Inserisci il nome del manga.")
    return r.set(chat.id, "SEARCH")


@bot.process_message
def process(chat, message):
    btns = botogram.Buttons()
    index = 0
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import botogram
import redis
from datetime import datetime

from .callback import camera, senato
import config

bot = botogram.create(config.TOKEN)
r = redis.StrictRedis(host=config.REDIS_HOST,
                      port=config.REDIS_PORT,
                      db=config.REDIS_DB,
                      password=config.REDIS_PASSWORD)


@bot.before_processing
def analytics(message):
    rhash = 'user:'******'id', message.sender.id)
    r.hset(rhash, 'username', message.sender.username)
    r.hset(rhash, 'last_access', str(datetime.now()))


@bot.command("start")
Exemple #34
0
    required = {
        "id": str,
        "from": botogram.User,
        "query": str,
    }
    optional = {
        "location": botogram.Location,
        "offest": str,
    }
    replace_keys = {"from": "sender"}


botogram.Update.optional["inline_query"] = InlineQuery

import botogram
bot = botogram.create(TOKEN)

from pyshorteners import Shortener
google = Shortener('Google', api_key=GOOGLE_API_KEY)


@bot.before_processing
def start(chat, message):
    if message.text == "/users":
        return False

    add_user(message.sender.id)

    text = (
        "<b>Welcome!</b>"
        "\nWith this bot you can <b>short</b> any (valid) <b>URL</b> in the <b>web!</b>"
import botogram
import random
from config import *


# Prepara il bot
bot = botogram.create(TELEGRAM_TOKEN)
# Lista dei messaggi
messages = (
    "Compra un raspberry pi!",
    "Ti sei ricordato di comparare un raspberry pi?",
    "Compralo!",
    "Anche Pelloni ne dovrebbe compare uno!",
    "Costa solo 45€!",
    "Se vuoi c'è anche quello da 5€!"
)


# Il messaggio in chat contiene 'raspberry'
@bot.message_contains("raspberry")
def raspberry_message(chat, message):
    """Invia un messaggio a random dalla lista messages"""
    send_raspberry_message(chat, message)


# Comando /raspberry
@bot.command("raspberry")
def raspberry_commad(chat, message):
    """Invia un messaggio a random dalla lista messages"""
    send_raspberry_message(chat, message)