Add Role, Emoji, and Permissions to the Guild type.
This commit is contained in:
parent
5fa52cd38b
commit
c8810604ac
|
@ -1,4 +1,4 @@
|
||||||
import json, discordobject, channel, member, options, nimcordutils
|
import json, discordobject, channel, member, options, nimcordutils, emoji, role, permission
|
||||||
|
|
||||||
type
|
type
|
||||||
ChannelType* = enum
|
ChannelType* = enum
|
||||||
|
@ -43,16 +43,15 @@ type
|
||||||
discoverySplash*: string
|
discoverySplash*: string
|
||||||
owner*: bool
|
owner*: bool
|
||||||
ownerID: snowflake
|
ownerID: snowflake
|
||||||
#TODO: Convert this to a Permissions type
|
permissions*: Permissions
|
||||||
permissions*: int
|
|
||||||
region*: string
|
region*: string
|
||||||
afkChannelID*: snowflake
|
afkChannelID*: snowflake
|
||||||
afkTimeout*: int
|
afkTimeout*: int
|
||||||
verificationLevel*: VerificationLevel
|
verificationLevel*: VerificationLevel
|
||||||
defaultMessageNotifications*: MessageNotificationsLevel
|
defaultMessageNotifications*: MessageNotificationsLevel
|
||||||
explicitContentFilter*: ExplicitContentFilterLevel
|
explicitContentFilter*: ExplicitContentFilterLevel
|
||||||
#roles*: seq[Role]
|
roles*: seq[Role]
|
||||||
#emojis*: seq[Emoji]
|
emojis*: seq[Emoji]
|
||||||
features*: seq[string]
|
features*: seq[string]
|
||||||
mfaLevel*: MFALevel
|
mfaLevel*: MFALevel
|
||||||
applicationID*: snowflake
|
applicationID*: snowflake
|
||||||
|
@ -97,8 +96,6 @@ proc newGuild*(json: JsonNode): Guild {.inline.} =
|
||||||
verificationLevel: VerificationLevel(json["verification_level"].getInt()),
|
verificationLevel: VerificationLevel(json["verification_level"].getInt()),
|
||||||
defaultMessageNotifications: MessageNotificationsLevel(json["default_message_notifications"].getInt()),
|
defaultMessageNotifications: MessageNotificationsLevel(json["default_message_notifications"].getInt()),
|
||||||
explicitContentFilter: ExplicitContentFilterLevel(json["explicit_content_filter"].getInt()),
|
explicitContentFilter: ExplicitContentFilterLevel(json["explicit_content_filter"].getInt()),
|
||||||
#roles
|
|
||||||
#emojis
|
|
||||||
#features
|
#features
|
||||||
mfaLevel: MFALevel(json["mfa_level"].getInt()),
|
mfaLevel: MFALevel(json["mfa_level"].getInt()),
|
||||||
applicationID: getIDFromJson(json["application_id"].getStr()),
|
applicationID: getIDFromJson(json["application_id"].getStr()),
|
||||||
|
@ -116,9 +113,13 @@ proc newGuild*(json: JsonNode): Guild {.inline.} =
|
||||||
# Parse all non guaranteed fields
|
# Parse all non guaranteed fields
|
||||||
if (json.contains("owner")):
|
if (json.contains("owner")):
|
||||||
g.owner = json["owner"].getBool()
|
g.owner = json["owner"].getBool()
|
||||||
if (json.contains("owner_id")):
|
if (json.contains("permissions")):
|
||||||
g.ownerID = getIDFromJson(json["owner_id"].getStr())
|
g.permissions = newPermissions(json["permissions"])
|
||||||
#TODO: permissions
|
for role in json["roles"]:
|
||||||
|
g.roles.add(newRole(role))
|
||||||
|
for emoji in json["emojis"]:
|
||||||
|
g.emojis.add(newEmoji(emoji))
|
||||||
|
#TODO features
|
||||||
if (json.contains("widget_enabled")):
|
if (json.contains("widget_enabled")):
|
||||||
g.widgetEnabled = json["widget_enabled"].getBool()
|
g.widgetEnabled = json["widget_enabled"].getBool()
|
||||||
if (json.contains("widget_channel_id")):
|
if (json.contains("widget_channel_id")):
|
||||||
|
|
Reference in New Issue