Skip to content

Fetching Discord Invite fails  #690

@yoggys

Description

@yoggys

Summary

Fetching Discord Invite fails

Reproduction Steps

Simply call the .fetch_invite function.
Below is the code from the cog.

Minimal Reproducible Code

@commands.command()
async def invite_info(self, ctx):
    try:
        online = await self.client.fetch_invite("https://discord.gg/...")
        #...
    except Exception as E:
        print(E)

Expected Results

Fetch should be performed correctly - we should be able to continue working on the invite variable, e.g. invite.approximate_presence_count

Actual Results

// Replaced private things with xxx

Traceback (most recent call last):
  File "c:\Users\User\Documents\GitHub\xxx\cogs\Stats.py", line 267, in invite_info
    online = await self.client.fetch_invite("discord.gg/xxx")
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 1386, in fetch_invite
    data = await self.http.get_invite(invite_id, with_counts=with_counts, with_expiration=with_expiration, guild_scheduled_event_id=event_id)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\http.py", line 1450, in get_invite
    'guild_scheduled_event_id': int(guild_scheduled_event_id),
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Intents

discord.Intents.all()

System Information

- Python v3.9.6-final
- py-cord v2.0.0-alpha
    - py-cord pkg_resources: v2.0.0a4732+g640c73ad
- aiohttp v3.7.4.post0
- system info: Windows 10 10.0.19044

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugA bug report that needs triaging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions