diff options
Diffstat (limited to 'lib/models')
| -rw-r--r-- | lib/models/attachment.ml | 9 | ||||
| -rw-r--r-- | lib/models/channel.ml | 17 | ||||
| -rw-r--r-- | lib/models/embed.ml | 44 | ||||
| -rw-r--r-- | lib/models/emoji.ml | 9 | ||||
| -rw-r--r-- | lib/models/guild.ml | 28 | ||||
| -rw-r--r-- | lib/models/member.ml | 8 | ||||
| -rw-r--r-- | lib/models/message.ml | 21 | ||||
| -rw-r--r-- | lib/models/reaction.ml | 4 | ||||
| -rw-r--r-- | lib/models/role.ml | 10 | ||||
| -rw-r--r-- | lib/models/snowflake.ml | 16 | ||||
| -rw-r--r-- | lib/models/user.ml | 7 |
11 files changed, 173 insertions, 0 deletions
diff --git a/lib/models/attachment.ml b/lib/models/attachment.ml new file mode 100644 index 0000000..095743d --- /dev/null +++ b/lib/models/attachment.ml @@ -0,0 +1,9 @@ +type t = { + id: Snowflake.t; + filename: string; + size: int; + url: string; + proxy_url: string; + height: int option; + width: int option; +}
\ No newline at end of file diff --git a/lib/models/channel.ml b/lib/models/channel.ml new file mode 100644 index 0000000..78051c3 --- /dev/null +++ b/lib/models/channel.ml @@ -0,0 +1,17 @@ +type t = { + id: Snowflake.t; + kind: int; + (* guild: Guild.t option; *) + position: int option; + permission_overwrites: (int list) option; + name: string option; + topic: string option; + nsfw: bool option; + bitrate: int option; + user_limit: int option; + recipients: (User.t list) option; + icon: string option; + owner_id: Snowflake.t option; + application_id: Snowflake.t option; + parent_id: Snowflake.t option; +}
\ No newline at end of file diff --git a/lib/models/embed.ml b/lib/models/embed.ml new file mode 100644 index 0000000..6ba1115 --- /dev/null +++ b/lib/models/embed.ml @@ -0,0 +1,44 @@ +type footer = { + text: string; + icon_url: string option; + proxy_icon_url: string option; +} + +type image = { + url: string option; + proxy_url: string option; + height: int option; + width: int option; +} + +type video = { + url: string option; + height: int option; + width: int option; +} + +type provider = { + name: string option; + url: string option; +} + +type field = { + name: string; + value: string; + inline: bool option; +} + +type t = { + title: string option; + kind: string option; + description: string option; + url: string option; + timestamp: string option; + colour: int option; + footer: footer option; + image: image option; + thumbnail: image option; + video: video option; + provider: provider option; + fields: (field list) option; +}
\ No newline at end of file diff --git a/lib/models/emoji.ml b/lib/models/emoji.ml new file mode 100644 index 0000000..3d89867 --- /dev/null +++ b/lib/models/emoji.ml @@ -0,0 +1,9 @@ +type t = { + id: Snowflake.t; + name: string; + roles: (Role.t list) option; + user: User.t option; + require_colons: bool option; + managed: bool; + animated: bool; +}
\ No newline at end of file diff --git a/lib/models/guild.ml b/lib/models/guild.ml new file mode 100644 index 0000000..364a4d5 --- /dev/null +++ b/lib/models/guild.ml @@ -0,0 +1,28 @@ +type t = { + id: Snowflake.t; + name: string; + icon: string; + splash: string; + owner: User.t; + region: string; + afk_channel: Channel.t option; + afk_timeout: int; + embed_enabled: bool; + embed_channel: Channel.t; + verification_level: int; + default_message_notifications: int; + explicit_content_filter: int; + roles: Role.t list; + emojis: Emoji.t list; + features: string list; + mfa_level: int; + application_id: Snowflake.t option; + widget_enabled: bool option; + widget_channel: Channel.t option; + system_channel: Channel.t option; + large: bool; + unavailable: bool; + member_count: int; + members: Member.t list; + channels: Channel.t list; +}
\ No newline at end of file diff --git a/lib/models/member.ml b/lib/models/member.ml new file mode 100644 index 0000000..1cbe50b --- /dev/null +++ b/lib/models/member.ml @@ -0,0 +1,8 @@ +type t = { + user: User.t; + nick: string option; + roles: Role.t list; + joined_at: string; + deaf: bool; + mute: bool; +}
\ No newline at end of file diff --git a/lib/models/message.ml b/lib/models/message.ml new file mode 100644 index 0000000..6c2e80d --- /dev/null +++ b/lib/models/message.ml @@ -0,0 +1,21 @@ +type t = { + id: Snowflake.t; + author: User.t; + channel: Channel.t; + member: Member.t option; + guild: Guild.t option; + content: string; + timestamp: string; + edited_timestamp: string option; + tts: bool; + mention_everyone: bool; + mentions: User.t list; + role_mentions: Role.t list; + attachments: Attachment.t list; + embeds: Embed.t list; + reactions: Reaction.t list; + nonce: Snowflake.t option; + pinned: bool; + webhook_id: Snowflake.t; + kind: int; +}
\ No newline at end of file diff --git a/lib/models/reaction.ml b/lib/models/reaction.ml new file mode 100644 index 0000000..b427505 --- /dev/null +++ b/lib/models/reaction.ml @@ -0,0 +1,4 @@ +type t = { + count: int; + emoji: Emoji.t; +}
\ No newline at end of file diff --git a/lib/models/role.ml b/lib/models/role.ml new file mode 100644 index 0000000..debba60 --- /dev/null +++ b/lib/models/role.ml @@ -0,0 +1,10 @@ +type t = { + id: Snowflake.t; + name: string; + colour: int; + hoist: bool; + position: int; + permissions: int; + managed: bool; + mentionable: bool; +}
\ No newline at end of file diff --git a/lib/models/snowflake.ml b/lib/models/snowflake.ml new file mode 100644 index 0000000..ed80b62 --- /dev/null +++ b/lib/models/snowflake.ml @@ -0,0 +1,16 @@ +type t = { + id: int; + as_string: string; +} + +let to_int t = t.id +let to_string t = t.as_string + +let from_int i = { + id = i; + as_string = string_of_int i; +} +let from_string s = { + id = int_of_string s; + as_string = s; +}
\ No newline at end of file diff --git a/lib/models/user.ml b/lib/models/user.ml new file mode 100644 index 0000000..05cf570 --- /dev/null +++ b/lib/models/user.ml @@ -0,0 +1,7 @@ +type t = { + id: Snowflake.t; + username: string; + discriminator: string; + avatar: string; + bot: bool; +}
\ No newline at end of file |