Improved cpl-query & added first types from discord

This commit is contained in:
2022-09-11 21:57:27 +02:00
parent 3c5ca594d5
commit 988965ed52
15 changed files with 211 additions and 3 deletions

View File

@@ -0,0 +1,42 @@
import discord
from cpl_discord.container.category_channel import CategoryChannel
from cpl_discord.container.container import Container
from cpl_discord.container.member import Member
from cpl_discord.container.role import Role
from cpl_discord.container.text_channel import TextChannel
from cpl_discord.container.voice_channel import VoiceChannel
from cpl_discord.helper.ToContainersConverter import ToContainersConverter
from cpl_query.extension import List
class Guild(discord.Guild, Container):
def __init__(self, _t: discord.Guild):
self._object: discord.Guild = _t
Container.__init__(self, _t, Guild)
@property
def categories(self) -> List[CategoryChannel]:
return List(CategoryChannel, ToContainersConverter.convert(self._object.categories, CategoryChannel))
@property
def members(self) -> List[Member]:
return List(Member, ToContainersConverter.convert(self._object.members, Member))
@property
def roles(self) -> List[Role]:
return List(Role, ToContainersConverter.convert(self._object.roles, Role))
@property
def text_channels(self) -> List[TextChannel]:
return List(TextChannel, ToContainersConverter.convert(self._object.text_channels, TextChannel))
@property
def threads(self) -> List[TextChannel]:
return List(TextChannel, ToContainersConverter.convert(self._object.threads, TextChannel))
@property
def voice_channels(self) -> List[VoiceChannel]:
return List(VoiceChannel, ToContainersConverter.convert(self._object.voice_channels, VoiceChannel))