0

I checked all the code and even tried to read other answers of this same error here on the forum, but I don't know where I'm wrong. Why AttributeError: 'NoneType' object has no attribute 'split'?

import re
from asyncio import (gather, get_event_loop, sleep)

from aiohttp import ClientSession
from pyrogram import (Client, filters, idle)
from Python_ARQ import ARQ

from config import bot, BOT_TOKEN, ARQ_API_KEY, ARQ_API_BASE_URL, LANGUAGE
bot_token= BOT_TOKEN

print("[INFO]: Checking... Your Details")

bot_id = int(bot_token.split(":")[0])
print("[INFO]: Code running by Jinn")
arq = None


async def lunaQuery(query: str, user_id: int):
    query = (
        query
        if LANGUAGE == "en"
        else (await arq.translate(query, "en")).result.translatedText
    )
    resp = (await arq.luna(query, user_id)).result
    return (
        resp
        if LANGUAGE == "en"
        else (
            await arq.translate(resp, LANGUAGE)
        ).result.translatedText
    )


    async def type_and_send(message):
        chat_id = message.chat.id
        user_id = message.from_user.id if message.from_user else 0
        query = message.text.strip()
        await message._client.send_chat_action(chat_id, "typing")
        response, _ = await gather(lunaQuery(query, user_id), sleep(2))
        if "Luna" in response:
            responsee = response.replace("Luna", "Nazriya")
        else:
            responsee = response
        if "Aco" in responsee:
            responsess = responsee.replace("Aco", "Nazriya")
        else:
            responsess = responsee
        if "Who is Nazriya?" in responsess:
            responsess2 = responsess.replace("Who is Nazriya?", "JINNS sister")
        else:
            responsess2 = responsess
        await message.reply_text(responsess2)
        await message._client.send_chat_action(chat_id, "cancel")
    
    
   @bot.on_message(
        ~filters.private | ~filters.group
        & filters.text
        & ~filters.command("start")
        & ~filters.edited,
    group=69,
)

I tried to change the return by yield, and change the attributes of the keys after the split.

In config I have this (don't know if it might be a problem here):

`from heroku3 import from_key
from pyrogram import Client

API_ID = int(os.environ.get("my id_telegram", "6"))
API_HASH = os.environ.get("my key",)
BOT_TOKEN = os.environ.get("my key", None)
ARQ_API_KEY = "my key" 
LANGUAGE = "en"
ARQ_API_BASE_URL = "https://thearq.tech"

bot = Client(":memory:",
             api_id=API_ID,
             api_hash=API_HASH,
             bot_token=BOT_TOKEN)` 

I already tried to create a new file and do

from nazriya import bot_token

if bot_token is not None:
     print(bot_token)
else:
     pass
Jhon Oliver
  • 149
  • 6

0 Answers0