5 changed files with 191 additions and 4 deletions
@ -0,0 +1,87 @@ |
|||||
|
from disco.types.base import ( |
||||
|
SlottedModel, Field, ListField, snowflake, text, enum, |
||||
|
) |
||||
|
from disco.types.guild import Integration |
||||
|
from disco.types.user import User |
||||
|
|
||||
|
|
||||
|
class AccessToken(SlottedModel): |
||||
|
access_token = Field(text) |
||||
|
token_type = Field(text) |
||||
|
expires_in = Field(int) |
||||
|
refresh_token = Field(text) |
||||
|
scope = Field(text) |
||||
|
|
||||
|
|
||||
|
class TeamMembershipState(object): |
||||
|
INVITED = 1 |
||||
|
ACCEPTED = 2 |
||||
|
|
||||
|
|
||||
|
class TeamMember(SlottedModel): |
||||
|
membership_state = Field(enum(TeamMembershipState)) |
||||
|
permissions = Field(text) |
||||
|
team_id = Field(snowflake) |
||||
|
user = Field(User) |
||||
|
|
||||
|
|
||||
|
class Team(SlottedModel): |
||||
|
icon = Field(text) |
||||
|
id = Field(snowflake) |
||||
|
members = ListField(TeamMember) |
||||
|
owner_user_id = Field(snowflake) |
||||
|
|
||||
|
|
||||
|
class Application(SlottedModel): |
||||
|
id = Field(snowflake) |
||||
|
name = Field(text) |
||||
|
icon = Field(text) |
||||
|
description = Field(text) |
||||
|
rpc_origins = ListField(text) |
||||
|
bot_public = Field(bool) |
||||
|
bot_require_code_grant = Field(bool) |
||||
|
owner = Field(User) |
||||
|
summary = Field(text) |
||||
|
verify_key = Field(text) |
||||
|
team = Field(Team) |
||||
|
guild_id = Field(snowflake) |
||||
|
primary_sku_id = Field(snowflake) |
||||
|
slug = Field(text) |
||||
|
cover_image = Field(text) |
||||
|
|
||||
|
def get_icon_url(self, fmt='webp', size=1024): |
||||
|
if not self.icon: |
||||
|
return '' |
||||
|
|
||||
|
return 'https://cdn.discordapp.com/app-icons/{}/{}.{}?size={}'.format(self.id, self.icon, fmt, size) |
||||
|
|
||||
|
def get_cover_image_url(self, fmt='webp', size=1024): |
||||
|
if not self.cover_image: |
||||
|
return '' |
||||
|
|
||||
|
return 'https://cdn.discordapp.com/app-icons/{}/{}.{}?size={}'.format(self.id, self.cover_image, fmt, size) |
||||
|
|
||||
|
@property |
||||
|
def icon_url(self): |
||||
|
return self.get_icon_url() |
||||
|
|
||||
|
@property |
||||
|
def cover_image_url(self): |
||||
|
return self.get_cover_image_url() |
||||
|
|
||||
|
|
||||
|
class ConnectionVisibility(object): |
||||
|
Nobody = 0 |
||||
|
Everyone = 1 |
||||
|
|
||||
|
|
||||
|
class Connection(SlottedModel): |
||||
|
id = Field(text) |
||||
|
name = Field(text) |
||||
|
type = Field(text) |
||||
|
revoked = Field(bool) |
||||
|
integrations = ListField(Integration) |
||||
|
verified = Field(bool) |
||||
|
friend_sync = Field(bool) |
||||
|
show_activity = Field(bool) |
||||
|
visibility = Field(enum(ConnectionVisibility)) |
Loading…
Reference in new issue