Voxel-Fox-Ltd/Novus

In version 0.1.4 (in all versions >0.0.7) create_thread leads to NameError: name 'Thread' is not defined

Closed this issue · 0 comments

Summary

calling create_thread on a TextChannel triggers a missing import in abc.py for Thread

Reproduction Steps

  1. Get some TextChannel object from your guild
  2. Run channel.create_thread(name='test name', type=discord.ChannelType.public_thread)

Minimal Reproducible Code

g = bot.guilds[0]
for c in g.channels:
    if type(c) is discord.TextChannel:
      c.create_thread(name='Test Thread', type=discord.ChannelType.public_thread)

Expected Results

  • Thread gets created
  • create_thread returns a Thread

Actual Results

  • Thread gets created
  • create_thread throws NameError: name 'Thread' is not defined in discord/abc.py:1674

Stacktrace:
Ignoring exception in on_component_interaction
Traceback (most recent call last):
File "/home/dth/IdeaProjects/TAWAttendanceDiscordBot/venv_new/lib/python/3.9/site-packages/discord/client.py", line 330, in _run_event
await coro(*args, **kwargs)
File "/home/dth/IdeaProjects/TAWAttendanceDiscordBot/src/cogs/onboarding.py", line 162, in on_component_interaction
await self.create_recruitment_thread(interaction.user, recruit, selectedsquad)
File "/home/dth/IdeaProjects/TAWAttendanceDiscordBot/src/cogs/onboarding.py", line 41, in create_recruitment_thread
thread = await pc.create_thread(name='Recruitment-Thread for '+initiator.name,
File "/home/dth/IdeaProjects/TAWAttendanceDiscordBot/venv_new/lib/python3.9/site-packages/discord/abc.py", line 1673, in create_thread
return Thread(guild=self.guild, state=self._state, data=data)
NameError: name 'Thread' is not defined

Intents

defaults() + members = True + voice_states = True

System Information

  • Python v3.9.2-final
  • Novus v0.1.2-alpha
    • Novus pkg_resources: v0.1.4
  • aiohttp v3.7.4.post0
  • system info: Linux 5.10.0-11-amd64 #1 SMP Debian 5.10.92-1 (2022-01-18)

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

This error seems to have come in ever since create_thread was moved from channel(s).py to abc.py