Exemplo n.º 1
0
import main
place = main.get_platform_command_code('telegram', 'place')


def run(bot, chat_id, user, keyConfig, message, totalResults=1):
    place.run(bot, chat_id, user, keyConfig, message, totalResults)
Exemplo n.º 2
0
import main
pronounce = main.get_platform_command_code('web', 'pronounce')


def run(keyConfig, message, totalResults=1):
    pronounce.run(keyConfig, message, totalResults)
Exemplo n.º 3
0
# coding=utf-8
import json
import urllib
from google.appengine.ext import ndb
from google.appengine.api import urlfetch
#import pafy

import main
getvid = main.get_platform_command_code('telegram', 'getvid')


class WhosHeardMP3Urls(ndb.Model):
    # key name: MP3Url
    whoseHeardMP3 = ndb.StringProperty(indexed=False, default='')


def addPreviouslyHeardMP3sValue(video_url, chat_id):
    es = WhosHeardMP3Urls.get_or_insert(video_url)
    if es.whoseHeardMP3 == '':
        es.whoseHeardMP3 = str(chat_id)
    else:
        es.whoseHeardMP3 += ',' + str(chat_id)
    es.put()


def getwhoseHeardMP3sValue(video_link):
    es = WhosHeardMP3Urls.get_or_insert(video_link)
    if es:
        return str(es.whoseHeardMP3)
    return ''
Exemplo n.º 4
0
import main
getgerman = main.get_platform_command_code('web', 'getgerman')


def run(keyConfig, message, totalResults=1):
    getgerman.run(keyConfig, message, totalResults)
Exemplo n.º 5
0
import main

getirish = main.get_platform_command_code('telegram', 'getirish')


def run(bot, chat_id, user, keyConfig, message, totalResults=1):
    getirish.run(bot, chat_id, user, keyConfig, message, totalResults)
Exemplo n.º 6
0
# coding=utf-8
import urllib
from bs4 import BeautifulSoup

import main
telegramgetflight = main.get_platform_command_code('telegram', 'getflight')


def run(keyConfig, message, totalResults=1):
    requestText = message.strip()
    if (requestText[3] == " " and requestText[7] == " "
            and requestText[12] == "-" and requestText[15] == "-"
            and len(requestText) > 19 and requestText[18] == " "
            and requestText[23] == "-" and requestText[26] == "-"):
        return telegramgetflight.get_returnflights(requestText)
    else:
        if (requestText[3] == " " and requestText[7] == " "
                and requestText[12] == "-" and requestText[15] == "-"):
            return telegramgetflight.get_flights(requestText)
        else:
            airportCode, error = telegramgetflight.get_airport_code(
                requestText)
            if airportCode != '':
                return airportCode
            else:
                if error:
                    return 'I\'m sorry Dave, ' + error
                else:
                    return 'I\'m sorry Dave, I\'m afraid I can\'t quite place ' + str(
                        requestText) + '.'
Exemplo n.º 7
0
import main
getgerman = main.get_platform_command_code('telegram', 'getgerman')
def run(bot, chat_id, user, keyConfig, message, totalResults=1):
    getgerman.run(bot, chat_id, user, keyConfig, message, totalResults)
Exemplo n.º 8
0
import main
crypto = main.get_platform_command_code('telegram', 'crypto')
def run(bot, chat_id, user, keyConfig, message, totalResults=1):
    return crypto.run(bot, chat_id, user, keyConfig, message, totalResults)
Exemplo n.º 9
0
# coding=utf-8
import urllib

import main
telegram_getacronym = main.get_platform_command_code('telegram', 'getacronym')


def run(keyConfig, message, totalResults=1):
    requestText = message.strip().upper()

    code = urllib.urlopen('http://www.abbreviations.com/' + requestText).read()
    resultsList = telegram_getacronym.acronym_results_parser(code)
    if resultsList:
        return acronym_results_printer(requestText, resultsList)
    else:
        return 'I\'m sorry Dave, I\'m afraid I can\'t find the acronym *' + str(
            requestText) + '*'


def acronym_results_printer(request, list):
    AllGameDetailsFormatted = str(request) + ' could mean:'
    for item in list:
        AllGameDetailsFormatted += '\n' + str(item).replace('Definition', '')
    return AllGameDetailsFormatted
Exemplo n.º 10
0
# coding=utf-8
import ConfigParser
import json
import string
import urllib
from google.appengine.ext import ndb
from google.appengine.api import urlfetch
import main
getlink = main.get_platform_command_code('telegram', 'getlink')


def run(bot, chat_id, user, keyConfig, message, totalResults=1):
    requestText = '+(.mkv|.mp4|.avi|.mov|.mpg|.wmv)  ' + str(message).strip(
    ) + '  intitle:"index of" -inurl:(jsp|pl|php|html|aspx|htm|cf|shtml) -inurl:(listen77|mp3raid|mp3toss|mp3drug|index_of|wallywashis)'
    keyConfig = ConfigParser.ConfigParser()
    keyConfig.read(["keys.ini", "..\keys.ini"])

    args = {
        'cx': keyConfig.get('Google', 'GCSE_OTHER_SE_ID'),
        'key': keyConfig.get('Google', 'GCSE_APP_ID'),
        'safe': "off",
        'q': requestText
    }
    bot.sendMessage(chat_id=chat_id,
                    text=getlink.Send_Links(chat_id, user,
                                            str(message).strip(), args,
                                            keyConfig, totalResults))