Skip to content
This repository was archived by the owner on Apr 30, 2024. It is now read-only.

Commit 3f4b131

Browse files
authored
Merge pull request #603 from UWPCommunity/rewrite/main
Alpha update
2 parents ca6d354 + 6e75dfe commit 3f4b131

File tree

59 files changed

+1485
-411
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1485
-411
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Quarrel © 2022
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Text;
6+
7+
namespace Discord.API.Models.Enums.Messages
8+
{
9+
public enum ComponentType
10+
{
11+
ActionRow = 1,
12+
Button = 2,
13+
SelectMenu = 3,
14+
TextInput = 4
15+
}
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Quarrel © 2022
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Text;
6+
7+
namespace Discord.API.Models.Enums.Messages
8+
{
9+
public enum InterationType
10+
{
11+
PING = 1,
12+
APPLICATION_COMMAND = 2,
13+
MESSAGE_COMPONENT = 3,
14+
APPLICATION_COMMAND_AUTOCOMPLETE = 4,
15+
MODAL_SUBMIT = 5,
16+
}
17+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Quarrel © 2022
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Text;
6+
7+
namespace Discord.API.Models.Enums.Messages
8+
{
9+
public enum MessageFlags
10+
{
11+
/// <summary>
12+
/// This message has been published to subscribed channels (via Channel Following)
13+
/// </summary>
14+
CROSSPOSTED = 0,
15+
16+
/// <summary>
17+
/// This message originated from a message in another channel (via Channel Following)
18+
/// </summary>
19+
IS_CROSSPOST = 1,
20+
21+
/// <summary>
22+
/// Do not include any embeds when serializing this message
23+
/// </summary>
24+
SUPPRESS_EMBEDS = 1 << 2,
25+
26+
/// <summary>
27+
/// The source message for this crosspost has been deleted (via Channel Following)
28+
/// </summary>
29+
SOURCE_MESSAGE_DELETED = 1 << 3,
30+
31+
/// <summary>
32+
/// This message came from the urgent message system
33+
/// </summary>
34+
URGENT = 1 << 4,
35+
36+
/// <summary>
37+
/// This message has an associated thread, with the same id as the message
38+
/// </summary>
39+
HAS_THREAD = 1 << 5,
40+
41+
/// <summary>
42+
/// This message is only visible to the user who invoked the Interaction
43+
/// </summary>
44+
EPHEMERAL = 1 << 6,
45+
46+
/// <summary>
47+
/// This message is an Interaction Response and the bot is "thinking"
48+
/// </summary>
49+
LOADING = 1 << 7,
50+
51+
/// <summary>
52+
/// This message failed to mention some roles and add their members to the thread
53+
/// </summary>
54+
FAILED_TO_MENTION_SOME_ROLES_IN_THREAD = 1 << 8,
55+
}
56+
57+
}

src/API/Discord.API/Models/Enums/Stickers/StickerFormatType.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ namespace Discord.API.Models.Enums.Stickers
77
/// </summary>
88
public enum StickerFormatType
99
{
10-
/// <summary>
11-
/// Not specified.
12-
/// </summary>
13-
None = 0,
14-
1510
/// <summary>
1611
/// PNG file.
1712
/// </summary>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Quarrel © 2022
2+
3+
using Discord.API.Models.Json.Users;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Text;
7+
using System.Text.Json.Serialization;
8+
9+
namespace Discord.API.Models.Json.Applications
10+
{
11+
internal class JsonApplication
12+
{
13+
[JsonPropertyName("id"), JsonNumberHandling(Constants.ReadWriteAsString)]
14+
public ulong Id { get; set; }
15+
16+
[JsonPropertyName("name")]
17+
public string Name { get; set; }
18+
19+
[JsonPropertyName("icon")]
20+
public string? Icon { get; set; }
21+
22+
[JsonPropertyName("description")]
23+
public string Description { get; set; }
24+
25+
[JsonPropertyName("rpc_origins")]
26+
public List<string>? RpcOrigins { get; set; }
27+
28+
[JsonPropertyName("bot_public")]
29+
public bool BotPublic { get; set; }
30+
31+
[JsonPropertyName("bot_require_code_grant")]
32+
public bool BotRequireCodeGrant { get; set; }
33+
34+
[JsonPropertyName("terms_of_service_url")]
35+
public string? TermsOfServiceUrl { get; set; }
36+
37+
[JsonPropertyName("privacy_policy_url")]
38+
public string? PrivacyPolicyUrl { get; set; }
39+
40+
[JsonPropertyName("owner")]
41+
public JsonUser? Owner { get; set; }
42+
43+
[JsonPropertyName("verify_key")]
44+
public string VerifyKey { get; set; }
45+
46+
/*
47+
[JsonPropertyName("team")]
48+
public JsonTeam? Team { get; set; }
49+
*/
50+
51+
[JsonPropertyName("guild_id"), JsonNumberHandling(Constants.ReadWriteAsString)]
52+
public ulong? GuildId { get; set; }
53+
54+
[JsonPropertyName("primary_sku_id"), JsonNumberHandling(Constants.ReadWriteAsString)]
55+
public ulong? PrimarySkuId { get; set; }
56+
57+
[JsonPropertyName("slug")]
58+
public string? Slug { get; set; }
59+
60+
[JsonPropertyName("cover_image")]
61+
public string? CoverImage { get; set; }
62+
63+
[JsonPropertyName("flags")]
64+
public int? Flags { get; set; }
65+
66+
[JsonPropertyName("tags")]
67+
public List<string>? Tags { get; set; }
68+
69+
/*
70+
[JsonPropertyName("install_params")]
71+
public JsonInstallParams? InstallParams { get; set; }
72+
*/
73+
74+
[JsonPropertyName("custom_install_url")]
75+
public string? CustomInstallUrl { get; set; }
76+
}
77+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Quarrel © 2022
2+
3+
using Discord.API.Models.Enums.Messages;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Text;
7+
using System.Text.Json.Serialization;
8+
9+
namespace Discord.API.Models.Json.Messages
10+
{
11+
internal class JsonComponent
12+
{
13+
[JsonPropertyName("type")]
14+
public ComponentType Type { get; set; }
15+
}
16+
}

src/API/Discord.API/Models/Json/Messages/JsonMessage.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
// Quarrel © 2022
22

33
using Discord.API.Models.Enums.Messages;
4+
using Discord.API.Models.Json.Applications;
5+
using Discord.API.Models.Json.Channels;
46
using Discord.API.Models.Json.Messages.Embeds;
57
using Discord.API.Models.Json.Reactions;
8+
using Discord.API.Models.Json.Stickers;
69
using Discord.API.Models.Json.Users;
710
using System;
11+
using System.Collections.Generic;
812
using System.Text.Json.Serialization;
913

1014
// JSON models don't need to respect standard nullable rules.
@@ -77,10 +81,31 @@ internal class JsonMessage
7781
[JsonPropertyName("activity")]
7882
public JsonMessageActivity? Activity { get; set; }
7983

84+
[JsonPropertyName("application")]
85+
public JsonApplication? Application { get; set; }
86+
87+
[JsonPropertyName("application_id"), JsonNumberHandling(Constants.ReadWriteAsString)]
88+
public long? ApplicationId { get; set; }
89+
8090
[JsonPropertyName("message_reference")]
8191
public JsonMessageReference? Reference { get; set; }
8292

93+
[JsonPropertyName("flags")]
94+
public MessageFlags? Flags { get; set; }
95+
8396
[JsonPropertyName("referenced_message")]
8497
public JsonMessage? ReferencedMessage { get; set; }
98+
99+
[JsonPropertyName("interaction")]
100+
public JsonMessageInteraction? Interaction { get; set; }
101+
102+
[JsonPropertyName("thread")]
103+
public JsonChannel? Thread { get; set; }
104+
105+
[JsonPropertyName("components")]
106+
public List<JsonMessageComponent>? Components { get; set; }
107+
108+
[JsonPropertyName("sticker_items")]
109+
public List<JsonMessageStickerItem>? StickerItems { get; set; }
85110
}
86111
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Quarrel © 2022
2+
3+
using Discord.API.Models.Enums.Messages;
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Text;
7+
using System.Text.Json.Serialization;
8+
9+
namespace Discord.API.Models.Json.Messages
10+
{
11+
internal class JsonMessageComponent
12+
{
13+
[JsonPropertyName("type")]
14+
public ComponentType Type { get; set; }
15+
16+
[JsonPropertyName("components")]
17+
public List<JsonComponent> Components { get; set; }
18+
}
19+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Quarrel © 2022
2+
3+
using Discord.API.Models.Enums.Messages;
4+
using Discord.API.Models.Json.Users;
5+
using System.Text.Json.Serialization;
6+
7+
namespace Discord.API.Models.Json.Messages
8+
{
9+
internal class JsonMessageInteraction
10+
{
11+
[JsonPropertyName("id"), JsonNumberHandling(Constants.ReadWriteAsString)]
12+
public ulong Id { get; set; }
13+
14+
[JsonPropertyName("type")]
15+
public InterationType Type { get; set; }
16+
17+
[JsonPropertyName("name")]
18+
public string Name { get; set; }
19+
20+
[JsonPropertyName("user")]
21+
public JsonUser User { get; set; }
22+
23+
[JsonPropertyName("member")]
24+
public JsonGuildMember? Mmber { get; set; }
25+
}
26+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Quarrel © 2022
2+
3+
using Discord.API.Models.Enums.Stickers;
4+
using System.Text.Json.Serialization;
5+
6+
namespace Discord.API.Models.Json.Messages
7+
{
8+
internal class JsonMessageStickerItem
9+
{
10+
[JsonPropertyName("id"), JsonNumberHandling(Constants.ReadWriteAsString)]
11+
public ulong Id { get; set; }
12+
13+
[JsonPropertyName("name")]
14+
public string Name { get; set; }
15+
16+
[JsonPropertyName("format_type")]
17+
public StickerFormatType FormatType { get; set; }
18+
}
19+
}

0 commit comments

Comments
 (0)