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

Commit 198223f

Browse files
authored
Merge pull request #588 from UWPCommunity/rewrite/main
Alpha update
2 parents 5ada12d + 759489d commit 198223f

File tree

3,762 files changed

+22556
-235
lines changed

Some content is hidden

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

3,762 files changed

+22556
-235
lines changed

src/API/Discord.API/Models/Enums/Guilds/ExplicitContentFilterLevel.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Quarrel © 2022
2+
3+
namespace Discord.API.Models.Enums.Settings
4+
{
5+
/// <summary>
6+
/// The content filter level.
7+
/// </summary>
8+
public enum ExplicitContentFilterLevel : int
9+
{
10+
/// <summary>
11+
/// Filter content from nobody.
12+
/// </summary>
13+
None,
14+
15+
/// <summary>
16+
/// Filter content not from my friends
17+
/// </summary>
18+
Public,
19+
20+
/// <summary>
21+
/// Filter content from everyone.
22+
/// </summary>
23+
All,
24+
}
25+
}

src/API/Discord.API/Models/Json/Guilds/JsonGuild.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Quarrel © 2022
22

33
using Discord.API.Models.Enums.Guilds;
4+
using Discord.API.Models.Enums.Settings;
45
using Discord.API.Models.Json.Channels;
56
using Discord.API.Models.Json.Emojis;
67
using Discord.API.Models.Json.Roles;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Quarrel © 2022
2+
3+
using System;
4+
using System.Text.Json.Serialization;
5+
6+
// JSON models don't need to respect standard nullable rules.
7+
#pragma warning disable CS8618
8+
9+
namespace Discord.API.Models.Json.Messages
10+
{
11+
internal class JsonCall
12+
{
13+
[JsonPropertyName("ended_timestamp")]
14+
public DateTimeOffset EndedTimestamp { get; set; }
15+
16+
[JsonPropertyName("participants"), JsonNumberHandling(Constants.ReadWriteAsString)]
17+
public ulong[] Participants { get; set; }
18+
}
19+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Quarrel © 2022
2+
3+
using Discord.API.Models.Enums.Channels;
4+
using System.Text.Json.Serialization;
5+
6+
// JSON models don't need to respect standard nullable rules.
7+
#pragma warning disable CS8618
8+
9+
namespace Discord.API.Models.Json.Messages
10+
{
11+
internal class JsonChannelMention
12+
{
13+
[JsonPropertyName("id")]
14+
public ulong Id { get; set; }
15+
16+
[JsonPropertyName("guild_id")]
17+
public ulong GuildId { get; set; }
18+
19+
[JsonPropertyName("type")]
20+
public ChannelType ChannelType { get; set; }
21+
22+
[JsonPropertyName("name")]
23+
public string Name { get; set; }
24+
}
25+
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Quarrel © 2022
22

3+
using Discord.API.Models.Enums.Messages;
34
using Discord.API.Models.Json.Messages.Embeds;
45
using Discord.API.Models.Json.Reactions;
56
using Discord.API.Models.Json.Users;
6-
using Discord.API.Models.Enums.Messages;
77
using System;
88
using System.Text.Json.Serialization;
99

@@ -32,6 +32,9 @@ internal class JsonMessage
3232
[JsonPropertyName("author")]
3333
public JsonUser? Author { get; set; }
3434

35+
[JsonPropertyName("call")]
36+
public JsonCall? Call { get; set; }
37+
3538
[JsonPropertyName("member")]
3639
public JsonGuildMember? Member { get; set; }
3740

@@ -56,6 +59,9 @@ internal class JsonMessage
5659
[JsonPropertyName("mention_roles"), JsonNumberHandling(Constants.ReadWriteAsString)]
5760
public ulong[]? RoleMentions { get; set; }
5861

62+
[JsonPropertyName("mention_channels")]
63+
public JsonChannelMention[]? ChannelMentions { get; set; }
64+
5965
[JsonPropertyName("attachments")]
6066
public JsonAttachment[]? Attachments { get; set; }
6167

src/API/Discord.API/Models/Json/Settings/JsonUserSettings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Quarrel © 2022
22

3+
using Discord.API.Models.Enums.Settings;
34
using System.Text.Json.Serialization;
45

56
// JSON models don't need to respect standard nullable rules.
@@ -48,5 +49,7 @@ internal class JsonUserSettings
4849
[JsonPropertyName("guild_folders")]
4950
public JsonGuildFolder[] GuildFolders { get; set; }
5051

52+
[JsonPropertyName("explicit_content_filter")]
53+
public ExplicitContentFilterLevel ExplicitContentFilter { get; set; }
5154
}
5255
}
Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,53 @@
11
// Quarrel © 2022
22

33
using Discord.API.Models.Json.Channels;
4+
using Quarrel.Client.Models.Channels.Interfaces;
45

56
namespace Quarrel.Client.Models.Channels.Abstract
67
{
7-
public abstract class PrivateChannel : Channel
8+
/// <summary>
9+
/// The base class for private channels.
10+
/// </summary>
11+
public abstract class PrivateChannel : Channel, IPrivateChannel
812
{
913
internal PrivateChannel(JsonChannel restChannel, QuarrelClient context) :
1014
base(restChannel, context)
1115
{
16+
LastMessageId = restChannel.LastMessageId;
17+
RTCRegion = restChannel.RTCRegion;
18+
}
19+
20+
/// <inheritdoc/>
21+
public int? MentionCount { get; private set; }
22+
23+
/// <inheritdoc/>
24+
public ulong? LastMessageId { get; private set; }
25+
26+
/// <inheritdoc/>
27+
public ulong? LastReadMessageId { get; private set; }
28+
29+
/// <inheritdoc/>
30+
public string? RTCRegion { get; private set; }
31+
32+
/// <inheritdoc/>
33+
public bool IsUnread => LastMessageId > LastReadMessageId;
34+
35+
int? IMessageChannel.MentionCount
36+
{
37+
get => MentionCount;
38+
set => MentionCount = value;
39+
}
40+
41+
ulong? IMessageChannel.LastMessageId
42+
{
43+
get => LastMessageId;
44+
set => LastMessageId = value;
45+
}
46+
47+
ulong? IMessageChannel.LastReadMessageId
48+
{
49+
get => LastReadMessageId;
50+
set => LastReadMessageId = value;
1251
}
1352
}
1453
}

src/Quarrel.Client/Models/Channels/DirectChannel.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,46 +20,11 @@ internal DirectChannel(JsonChannel restChannel, QuarrelClient context) :
2020
Guard.IsNotNull(restChannel.Recipients, nameof(restChannel.Recipients));
2121

2222
RecipientId = restChannel.Recipients[0].Id;
23-
LastMessageId = restChannel.LastMessageId;
24-
RTCRegion = restChannel.RTCRegion;
2523
}
2624

2725
/// <inheritdoc/>
2826
public ulong RecipientId { get; private set; }
2927

30-
/// <inheritdoc/>
31-
public int? MentionCount { get; private set; }
32-
33-
/// <inheritdoc/>
34-
public ulong? LastMessageId { get; private set; }
35-
36-
/// <inheritdoc/>
37-
public ulong? LastReadMessageId { get; private set; }
38-
39-
/// <inheritdoc/>
40-
public bool IsUnread => LastMessageId > LastReadMessageId;
41-
42-
int? IMessageChannel.MentionCount
43-
{
44-
get => MentionCount;
45-
set => MentionCount = value;
46-
}
47-
48-
ulong? IMessageChannel.LastMessageId
49-
{
50-
get => LastMessageId;
51-
set => LastMessageId = value;
52-
}
53-
54-
ulong? IMessageChannel.LastReadMessageId
55-
{
56-
get => LastReadMessageId;
57-
set => LastReadMessageId = value;
58-
}
59-
60-
/// <inheritdoc/>
61-
public string? RTCRegion { get; private set; }
62-
6328
/// <summary>
6429
/// Gets the recipient of the direct message channel.
6530
/// </summary>

src/Quarrel.Client/Models/Channels/GroupChannel.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@ internal GroupChannel(JsonChannel restChannel, QuarrelClient context) :
2323

2424
OwnerId = restChannel.OwnerId.Value;
2525

26-
RTCRegion = restChannel.RTCRegion;
2726
Recipients = restChannel.Recipients.Select(x => new User(x, context)).ToArray();
2827
Icon = restChannel.Icon;
29-
LastMessageId = restChannel.LastMessageId;
3028
}
3129

3230
/// <inheritdoc/>
3331
public ulong OwnerId { get; private set; }
3432

35-
/// <inheritdoc/>
36-
public string? RTCRegion { get; private set; }
37-
3833
/// <inheritdoc/>
3934
public User[] Recipients { get; private set; }
4035

@@ -43,36 +38,6 @@ internal GroupChannel(JsonChannel restChannel, QuarrelClient context) :
4338

4439
IUser[] IGroupChannel.Recipients => Recipients;
4540

46-
/// <inheritdoc/>
47-
public int? MentionCount { get; internal set; }
48-
49-
/// <inheritdoc/>
50-
public ulong? LastMessageId { get; internal set; }
51-
52-
/// <inheritdoc/>
53-
public ulong? LastReadMessageId { get; internal set; }
54-
55-
/// <inheritdoc/>
56-
public bool IsUnread => LastMessageId > LastReadMessageId;
57-
58-
int? IMessageChannel.MentionCount
59-
{
60-
get => MentionCount;
61-
set => MentionCount = value;
62-
}
63-
64-
ulong? IMessageChannel.LastMessageId
65-
{
66-
get => LastMessageId;
67-
set => LastMessageId = value;
68-
}
69-
70-
ulong? IMessageChannel.LastReadMessageId
71-
{
72-
get => LastReadMessageId;
73-
set => LastReadMessageId = value;
74-
}
75-
7641
internal override JsonChannel ToJsonChannel()
7742
{
7843
JsonChannel restChannel = base.ToJsonChannel();

0 commit comments

Comments
 (0)