1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Added start function

This commit is contained in:
Steffo 2017-03-22 17:23:17 +01:00
parent 2b62806529
commit 2699d5c5f1

View file

@ -1,5 +1,4 @@
import asyncio import asyncio
loop = asyncio.get_event_loop()
import telegram import telegram
import random import random
import datetime import datetime
@ -11,9 +10,11 @@ import database
import markovify import markovify
import discord import discord
loop = asyncio.get_event_loop()
b = telegram.Bot(royalbotconfig.telegram_token) b = telegram.Bot(royalbotconfig.telegram_token)
d = discord.Client() d = discord.Client()
def currently_logged_in(update): def currently_logged_in(update):
"""Trova l'utente connesso all'account di Telegram che ha mandato l'update.""" """Trova l'utente connesso all'account di Telegram che ha mandato l'update."""
session = database.Session() session = database.Session()
@ -21,6 +22,14 @@ def currently_logged_in(update):
return user return user
async def start(bot, update, arguments):
user = currently_logged_in(update)
if user is None:
await update.message.reply(f"Ciao!\n_Non hai eseguito l'accesso al RYGdb.")
else:
await update.message.reply(f"Ciao!\n_Hai eseguito l'accesso come_ `{user}`.")
async def diario(bot, update, arguments): async def diario(bot, update, arguments):
"""Aggiungi una frase al diario Royal Games. """Aggiungi una frase al diario Royal Games.
@ -277,6 +286,7 @@ Sintassi: `/cv`"""
if __name__ == "__main__": if __name__ == "__main__":
# Init Telegram bot commands # Init Telegram bot commands
b.commands["start"] = start
b.commands["leggi"] = leggi b.commands["leggi"] = leggi
b.commands["diario"] = diario b.commands["diario"] = diario
b.commands["discord"] = discord b.commands["discord"] = discord