Giter Club home page Giter Club logo

tgyaoqing's People

Contributors

jinyan-hope avatar

Stargazers

 avatar  avatar

Watchers

 avatar

tgyaoqing's Issues

大佬还更新吗 有些报错

Traceback (most recent call last):
File "D:\Python312\Lib\site-packages\aiohttp\connector.py", line 1025, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\asyncio\base_events.py", line 1122, in create_connection
raise exceptions[0]
File "D:\Python312\Lib\asyncio\base_events.py", line 1104, in create_connection
sock = await self._connect_sock(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\asyncio\base_events.py", line 1007, in _connect_sock
await self.sock_connect(sock, address)
File "D:\Python312\Lib\asyncio\proactor_events.py", line 727, in sock_connect
return await self._proactor.connect(sock, address)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\asyncio\windows_events.py", line 803, in _poll
value = callback(transferred, key, ov)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\asyncio\windows_events.py", line 599, in finish_connect
ov.getresult()
OSError: [WinError 121] 信号灯超时时间已到

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\Python312\Lib\site-packages\aiogram\client\session\aiohttp.py", line 170, in make_request
async with session.post(
File "D:\Python312\Lib\site-packages\aiohttp\client.py", line 1197, in aenter
self._resp = await self._coro
^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\aiohttp\client.py", line 581, in _request
conn = await self._connector.connect(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\aiohttp\connector.py", line 544, in connect
proto = await self._create_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\aiohttp\connector.py", line 944, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\aiohttp\connector.py", line 1257, in _create_direct_connection
raise last_exc
File "D:\Python312\Lib\site-packages\aiohttp\connector.py", line 1226, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\aiohttp\connector.py", line 1033, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [信号灯超时时间已到]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\gary\Downloads\tgyaoqing-main\main.py", line 33, in
bot_info = asyncio.run(get_bot_info())
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\gary\Downloads\tgyaoqing-main\main.py", line 29, in get_bot_info
bot_info = await bot.get_me()
^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\aiogram\client\bot.py", line 1839, in get_me
return await self(call, request_timeout=request_timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\aiogram\client\bot.py", line 508, in call
return await self.session(self, method, timeout=request_timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\aiogram\client\session\base.py", line 254, in call
return cast(TelegramType, await middleware(bot, method))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python312\Lib\site-packages\aiogram\client\session\aiohttp.py", line 177, in make_request
raise TelegramNetworkError(method=method, message=f"{type(e).name}: {e}")
aiogram.exceptions.TelegramNetworkError: HTTP Client says - ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [信号灯超时时间已到]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000022B33DC3920>

请教大佬 如何统计用户的邀请人数

定义了get_invited_count函数,用于统计数量

def get_invited_count(user_id):  
    conn = sqlite3.connect(db_filename)  
    cursor = conn.cursor()  
    # 查询 users 表中邀请者为 user_id 的记录数量  
    cursor.execute("SELECT COUNT(*) FROM users WHERE invited_by = ?", (user_id,))  
    count = cursor.fetchone()[0]  
    conn.close()  
    return count

查询积分

# 处理用户点击 "查询积分" 命令
@dp.message_handler(lambda message: message.text == "查询积分")
async def check_score(message: types.Message):
    user_id = str(message.from_user.id)

    # 查询用户的积分值
    score = get_score(user_id)

    # 获取已邀请的人数
    invited_count = get_invited_count(user_id)   

    # 发送用户的积分值
    await message.answer(f"您的当前积分是 {score}。\n您已邀请 {invited_count} 人", reply_markup=custom_keyboard)

现在出现的问题是貌似无法统计数量

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.