mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Added start function
This commit is contained in:
parent
2b62806529
commit
2699d5c5f1
1 changed files with 11 additions and 1 deletions
12
grandbot.py
12
grandbot.py
|
@ -1,5 +1,4 @@
|
|||
import asyncio
|
||||
loop = asyncio.get_event_loop()
|
||||
import telegram
|
||||
import random
|
||||
import datetime
|
||||
|
@ -11,9 +10,11 @@ import database
|
|||
import markovify
|
||||
import discord
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
b = telegram.Bot(royalbotconfig.telegram_token)
|
||||
d = discord.Client()
|
||||
|
||||
|
||||
def currently_logged_in(update):
|
||||
"""Trova l'utente connesso all'account di Telegram che ha mandato l'update."""
|
||||
session = database.Session()
|
||||
|
@ -21,6 +22,14 @@ def currently_logged_in(update):
|
|||
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):
|
||||
"""Aggiungi una frase al diario Royal Games.
|
||||
|
||||
|
@ -277,6 +286,7 @@ Sintassi: `/cv`"""
|
|||
|
||||
if __name__ == "__main__":
|
||||
# Init Telegram bot commands
|
||||
b.commands["start"] = start
|
||||
b.commands["leggi"] = leggi
|
||||
b.commands["diario"] = diario
|
||||
b.commands["discord"] = discord
|
||||
|
|
Loading…
Reference in a new issue