commands.IntConverter Gives an Error #9

Closed
opened 2026-02-15 23:16:12 -05:00 by yindo · 2 comments
Owner

Originally created by @4444dogs on GitHub (Jun 23, 2022).

Describe the bug
When you try to use IntConverter() you get the following error.
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Context'

To Reproduce

@commands.command(name='randomnum')
    async def randomnum(ctx, num1, num2):

        randomcalc = randint(commands.IntConverter(num1), commands.IntConverter(num2))
        await ctx.message.channel.send(str(randomcalc))

Expected behavior
Instead of an error, the function should return an int value.

Library version

Name: revolt.py
Version: 0.1.8
Summary: Python wrapper for the revolt.chat API
Home-page: https://github.com/revoltchat/revolt.py
Author: Zomatee
Author-email: me@zomatree.live
License: MIT
Location: c:\users\lee\appdata\local\programs\python\python310\lib\site-packages
Requires: aenum, aiohttp, typing-extensions, ulid-py
Originally created by @4444dogs on GitHub (Jun 23, 2022). **Describe the bug** When you try to use `IntConverter()` you get the following error. `TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Context'` **To Reproduce** ```python @commands.command(name='randomnum') async def randomnum(ctx, num1, num2): randomcalc = randint(commands.IntConverter(num1), commands.IntConverter(num2)) await ctx.message.channel.send(str(randomcalc)) ``` **Expected behavior** Instead of an error, the function should return an `int` value. **Library version** ``` Name: revolt.py Version: 0.1.8 Summary: Python wrapper for the revolt.chat API Home-page: https://github.com/revoltchat/revolt.py Author: Zomatee Author-email: me@zomatree.live License: MIT Location: c:\users\lee\appdata\local\programs\python\python310\lib\site-packages Requires: aenum, aiohttp, typing-extensions, ulid-py ```
yindo added the invalid label 2026-02-15 23:16:12 -05:00
yindo closed this issue 2026-02-15 23:16:12 -05:00
Author
Owner

@Zomatree commented on GitHub (Jun 23, 2022):

You are missing the self parameter, and you are suppose to typehint num1 and num2 with IntConverter instead of manually calling it.

@Zomatree commented on GitHub (Jun 23, 2022): You are missing the `self` parameter, and you are suppose to typehint `num1` and `num2` with `IntConverter` instead of manually calling it.
Author
Owner

@4444dogs commented on GitHub (Jun 23, 2022):

You are missing the self parameter, and you are suppose to typehint num1 and num2 with IntConverter instead of manually calling it.

Thanks! I didn't realize it was something I was doing lol.

@4444dogs commented on GitHub (Jun 23, 2022): > You are missing the `self` parameter, and you are suppose to typehint `num1` and `num2` with `IntConverter` instead of manually calling it. Thanks! I didn't realize it was something I was doing lol.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: stoatchat/python-client-sdk#9