1010import discord
1111
1212from resources .utils .debug import debug , DebugColor
13- from .server_attributes import ServerAttributes , GuildAttributeType
13+ from .server_attributes import ServerAttributes , GuildAttributeType , MessageableGuildChannel
1414from .server_attribute_ids import ServerAttributeIds
1515from .enabled_modules import EnabledModules
1616
@@ -123,7 +123,7 @@ def is_attribute_type(val: type):
123123 )
124124 return f
125125
126- funcs : set [Callable [[int ], GuildAttributeType | discord . abc . PrivateChannel | None ]] = set ()
126+ funcs : set [Callable [[int ], GuildAttributeType | None ]] = set ()
127127
128128 if is_attribute_type (discord .Guild ):
129129 funcs .add (client .get_guild )
@@ -133,9 +133,10 @@ def is_attribute_type(val: type):
133133 # parse if the type matches exactly.
134134 funcs .add (guild .get_channel_or_thread )
135135 if is_attribute_type (discord .abc .Messageable ):
136- funcs .add (client .get_channel )
136+ # There is no attribute that gives a PrivateChannel
137+ funcs .add (typing .cast (Callable [[int ], MessageableGuildChannel | None ], client .get_channel ))
137138 if is_attribute_type (discord .TextChannel ):
138- funcs .add (client .get_channel )
139+ funcs .add (typing . cast ( Callable [[ int ], discord . TextChannel | None ], client .get_channel ) )
139140 if is_attribute_type (discord .User ):
140141 funcs .add (client .get_user )
141142 if is_attribute_type (discord .Role ):
@@ -144,9 +145,9 @@ def is_attribute_type(val: type):
144145 # I think it's safe to assume the stored value was an object of
145146 # the correct type in the first place. As in, it's a
146147 # CategoryChannel id, not a VoiceChannel id.
147- funcs .add (client .get_channel )
148+ funcs .add (typing . cast ( Callable [[ int ], discord . CategoryChannel | None ], client .get_channel ) )
148149 if is_attribute_type (discord .channel .VoiceChannel ):
149- funcs .add (client .get_channel )
150+ funcs .add (typing . cast ( Callable [[ int ], discord . VoiceChannel | None ], client .get_channel ) )
150151 if is_attribute_type (discord .Emoji ):
151152 funcs .add (guild .get_emoji )
152153 if is_attribute_type (int ):
0 commit comments