async def testLoop(): while True: #Define a message that we want to send a = Answer('greeting', "user", receiver=userID) # yield it to samt yield a #wait 10 seconds await asyncio.sleep(10)
def start(): ant = ['file', 'video', 'nothing'] blubb = yield Answer("Return Type\n/cancel", choices=ant) if (blubb == '/cancel') or (blubb not in ant): yield Answer('canceld') return url = Context.get('message').text #get the full URL modes = getModes(url) selection = yield Answer("formatChoice", choices=list(modes)) #selection = '720p60 mp4' downloadVideo(url, modes[selection]) filename = getVideoFilename(url, modes[selection]) if blubb == 'nothing': yield Answer("Done") elif blubb == 'file': yield 'document:' + path + '/data/' + filename + ";It's me!\n" + filename elif blubb == 'video': yield 'video:' + path + '/data/' + filename + ";It's me!\n" + filename
def test(): def callback(msg): a = Answer("Interessiert mich nicht " + msg) a.mark_as_answer = False return a q = Answer("<b>W</b><i>ill</i>ste?", choices=[ "Ja" "Nein", "Vielleicht", "Möglichweise", "Ein klares womöglich" ], callback=callback) # q.markup = "Markdown" return q
def guten_tag(): a = Answer('greeting', Context.get('user')) a.language_feature = False return a
async def start(): return Answer('greeting', Context.get('user'))
def callback(msg): a = Answer("Interessiert mich nicht " + msg) a.mark_as_answer = False return a
def key(): a = Answer("keyboard entfernt", keyboard=0) return a
def key(): a = Answer("Hier isses", keyboard=["Ja", "Nein", "Nööö", "..."]) return a
def key(): a = Answer("Hier isses", keyboard=[["Ja"], ["Nein"], ["Nööö"], ["..."]]) return a
def rewrite(): return Answer("newMessage", edit_id=Context.get("history")[0].id)
async def talk(): x = yield Answer("Was willst du?\n" "/stop zum Abbrechen\n") if x == "/stop": yield Answer("abgebrochen") elif len(x) > 0: yield Answer(x)