Exemplo n.º 1
0
async def _auth(c, m):
    if len(m.command) == 1:
        await m.reply_text(tr.NO_AUTH_CODE_MSG, True)
        return

    code = m.command[1]

    try:
        auth = GoogleAuth(Config.CLIENT_ID, Config.CLIENT_SECRET)

        auth.Auth(code)

        auth.SaveCredentialsFile(Config.CRED_FILE)

        msg = await m.reply_text(tr.AUTH_SUCCESS_MSG, True)

        with open(Config.CRED_FILE, 'r') as f:
            cred_data = f.read()

        msg2 = await msg.reply_text(cred_data, parse_mode=None)
        await msg2.reply_text(
            "This is your authorisation data! Save this for later use. Reply /save_auth_data to the authorisation data to re authorise later.",
            True)

    except Exception as e:
        traceback.print_exc()
        await m.reply_text(tr.AUTH_FAILED_MSG.format(e), True)
Exemplo n.º 2
0
async def _auth(c, m):
    if len(m.command) == 1:
        await m.reply_text(tr.NO_AUTH_CODE_MSG, True)
        return

    code = m.command[1]

    try:
        auth = GoogleAuth(Config.CLIENT_ID, Config.CLIENT_SECRET)

        auth.Auth(code)

        auth.SaveCredentialsFile(Config.CRED_FILE)

        msg = await m.reply_text(tr.AUTH_SUCCESS_MSG, True)

        with open(Config.CRED_FILE, 'r') as f:
            cred_data = f.read()

        msg2 = await msg.reply_text(cred_data, parse_mode=None)
        await msg2.reply_text(
            "Bu sizin yetkilendirme verileriniz! Bunu daha sonra kullanmak üzere kaydedin. Yanıtla /save_auth_data daha sonra yeniden yetkilendirmek için yetkilendirme verilerine.",
            True)

    except Exception as e:
        traceback.print_exc()
        await m.reply_text(tr.AUTH_FAILED_MSG.format(e), True)
Exemplo n.º 3
0
async def _auth(c, m):

    if (len(m.command) == 1):
        await m.reply_text(text=tr.NO_AUTH_CODE_MSG)
        return

    code = m.command[1]

    try:

        auth = GoogleAuth(Config.CLIENT_ID, Config.CLIENT_SECRET)

        auth.Auth(code)

        auth.SaveCredentialsFile(Config.CRED_FILE)

        await m.reply_text(text=tr.AUTH_SUCCESS_MSG)

    except Exception as e:
        traceback.print_exc()
        await m.reply_text(text=tr.AUTH_FAILED_MSG.format(e))