Skip to content

Commit 55330cd

Browse files
committed
Implement support for soundboards.
See discord/discord-api-docs#6260 and discord/discord-api-docs#7207.
1 parent ecf724a commit 55330cd

File tree

49 files changed

+1945
-2
lines changed

Some content is hidden

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

49 files changed

+1945
-2
lines changed

Backend/Remora.Discord.API.Abstractions/API/Gateway/Commands/GatewayIntents.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ public enum GatewayIntents
7676
/// Subscribes to the following events:
7777
/// - GUILD_EMOJIS_UPDATE
7878
/// - GUILD_STICKERS_UPDATE
79+
/// - GUILD_SOUNDBOARD_SOUND_CREATE
80+
/// - GUILD_SOUNDBOARD_SOUND_UPDATE
81+
/// - GUILD_SOUNDBOARD_SOUND_DELETE
82+
/// - GUILD_SOUNDBOARD_SOUNDS_UPDATE
7983
/// </summary>
80-
GuildEmojisAndStickers = 1 << 3,
84+
GuildExpressions = 1 << 3,
8185

8286
/// <summary>
8387
/// Subscribes to the following events:
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// IRequestSoundboardSounds.cs
3+
//
4+
// Author:
5+
// Jarl Gullberg <[email protected]>
6+
//
7+
// Copyright (c) Jarl Gullberg
8+
//
9+
// This program is free software: you can redistribute it and/or modify
10+
// it under the terms of the GNU Lesser General Public License as published by
11+
// the Free Software Foundation, either version 3 of the License, or
12+
// (at your option) any later version.
13+
//
14+
// This program is distributed in the hope that it will be useful,
15+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
// GNU Lesser General Public License for more details.
18+
//
19+
// You should have received a copy of the GNU Lesser General Public License
20+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
//
22+
23+
using System.Collections.Generic;
24+
using JetBrains.Annotations;
25+
using Remora.Rest.Core;
26+
27+
namespace Remora.Discord.API.Abstractions.Gateway.Commands;
28+
29+
/// <summary>
30+
/// Represents a request for the soundboard sounds of the given guilds.
31+
/// </summary>
32+
[PublicAPI]
33+
public interface IRequestSoundboardSounds
34+
{
35+
/// <summary>
36+
/// Gets the guild IDs of the guilds to get the soundboard sounds of.
37+
/// </summary>
38+
IReadOnlyList<Snowflake> GuildIDs { get; }
39+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// IGuildSoundboardSoundCreate.cs
3+
//
4+
// Author:
5+
// Jarl Gullberg <[email protected]>
6+
//
7+
// Copyright (c) Jarl Gullberg
8+
//
9+
// This program is free software: you can redistribute it and/or modify
10+
// it under the terms of the GNU Lesser General Public License as published by
11+
// the Free Software Foundation, either version 3 of the License, or
12+
// (at your option) any later version.
13+
//
14+
// This program is distributed in the hope that it will be useful,
15+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
// GNU Lesser General Public License for more details.
18+
//
19+
// You should have received a copy of the GNU Lesser General Public License
20+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
//
22+
23+
using Remora.Discord.API.Abstractions.Objects.Soundboard;
24+
25+
namespace Remora.Discord.API.Abstractions.Gateway.Events;
26+
27+
/// <summary>
28+
/// Represents a creation event for a soundboard sound.
29+
/// </summary>
30+
public interface IGuildSoundboardSoundCreate : IGatewayEvent, ISoundboardSound;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// IGuildSoundboardSoundDelete.cs
3+
//
4+
// Author:
5+
// Jarl Gullberg <[email protected]>
6+
//
7+
// Copyright (c) Jarl Gullberg
8+
//
9+
// This program is free software: you can redistribute it and/or modify
10+
// it under the terms of the GNU Lesser General Public License as published by
11+
// the Free Software Foundation, either version 3 of the License, or
12+
// (at your option) any later version.
13+
//
14+
// This program is distributed in the hope that it will be useful,
15+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
// GNU Lesser General Public License for more details.
18+
//
19+
// You should have received a copy of the GNU Lesser General Public License
20+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
//
22+
23+
using Remora.Rest.Core;
24+
25+
namespace Remora.Discord.API.Abstractions.Gateway.Events;
26+
27+
/// <summary>
28+
/// Represents a delete event for a soundboard sound.
29+
/// </summary>
30+
public interface IGuildSoundboardSoundDelete : IGatewayEvent
31+
{
32+
/// <summary>
33+
/// Gets the ID of the deleted sound.
34+
/// </summary>
35+
Snowflake SoundID { get; }
36+
37+
/// <summary>
38+
/// Gets the ID of the guild the sound was deleted from.
39+
/// </summary>
40+
Snowflake GuildID { get; }
41+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// IGuildSoundboardSoundUpdate.cs
3+
//
4+
// Author:
5+
// Jarl Gullberg <[email protected]>
6+
//
7+
// Copyright (c) Jarl Gullberg
8+
//
9+
// This program is free software: you can redistribute it and/or modify
10+
// it under the terms of the GNU Lesser General Public License as published by
11+
// the Free Software Foundation, either version 3 of the License, or
12+
// (at your option) any later version.
13+
//
14+
// This program is distributed in the hope that it will be useful,
15+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
// GNU Lesser General Public License for more details.
18+
//
19+
// You should have received a copy of the GNU Lesser General Public License
20+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
//
22+
23+
using Remora.Discord.API.Abstractions.Objects.Soundboard;
24+
25+
namespace Remora.Discord.API.Abstractions.Gateway.Events;
26+
27+
/// <summary>
28+
/// Represents an update event for a soundboard sound.
29+
/// </summary>
30+
public interface IGuildSoundboardSoundUpdate : IGatewayEvent, ISoundboardSound;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// IGuildSoundboardSoundsUpdate.cs
3+
//
4+
// Author:
5+
// Jarl Gullberg <[email protected]>
6+
//
7+
// Copyright (c) Jarl Gullberg
8+
//
9+
// This program is free software: you can redistribute it and/or modify
10+
// it under the terms of the GNU Lesser General Public License as published by
11+
// the Free Software Foundation, either version 3 of the License, or
12+
// (at your option) any later version.
13+
//
14+
// This program is distributed in the hope that it will be useful,
15+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
// GNU Lesser General Public License for more details.
18+
//
19+
// You should have received a copy of the GNU Lesser General Public License
20+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
//
22+
23+
using System.Collections.Generic;
24+
using JetBrains.Annotations;
25+
using Remora.Discord.API.Abstractions.Objects.Soundboard;
26+
using Remora.Rest.Core;
27+
28+
namespace Remora.Discord.API.Abstractions.Gateway.Events;
29+
30+
/// <summary>
31+
/// Represents a batch of update events for soundboard sounds.
32+
/// </summary>
33+
[PublicAPI]
34+
public interface IGuildSoundboardSoundsUpdate : IGatewayEvent
35+
{
36+
/// <summary>
37+
/// Gets the updated soundboard sounds.
38+
/// </summary>
39+
IReadOnlyList<ISoundboardSound> SoundboardSounds { get; }
40+
41+
/// <summary>
42+
/// Gets the ID of the guild that the sounds were updated in.
43+
/// </summary>
44+
Snowflake GuildID { get; }
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// ISoundboardSounds.cs
3+
//
4+
// Author:
5+
// Jarl Gullberg <[email protected]>
6+
//
7+
// Copyright (c) Jarl Gullberg
8+
//
9+
// This program is free software: you can redistribute it and/or modify
10+
// it under the terms of the GNU Lesser General Public License as published by
11+
// the Free Software Foundation, either version 3 of the License, or
12+
// (at your option) any later version.
13+
//
14+
// This program is distributed in the hope that it will be useful,
15+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
// GNU Lesser General Public License for more details.
18+
//
19+
// You should have received a copy of the GNU Lesser General Public License
20+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21+
//
22+
23+
using System.Collections.Generic;
24+
using JetBrains.Annotations;
25+
using Remora.Discord.API.Abstractions.Objects.Soundboard;
26+
using Remora.Rest.Core;
27+
28+
namespace Remora.Discord.API.Abstractions.Gateway.Events;
29+
30+
/// <summary>
31+
/// Represents a batch of requested soundboard sounds.
32+
/// </summary>
33+
[PublicAPI]
34+
public interface ISoundboardSounds : IGatewayEvent
35+
{
36+
/// <summary>
37+
/// Gets the soundboard sounds.
38+
/// </summary>
39+
IReadOnlyList<ISoundboardSound> Sounds { get; }
40+
41+
/// <summary>
42+
/// Gets the ID of the guild that the sounds belong to.
43+
/// </summary>
44+
Snowflake GuildID { get; }
45+
}

Backend/Remora.Discord.API.Abstractions/API/Gateway/OperationCode.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,10 @@ public enum OperationCode
8888
/// <summary>
8989
/// Sent in response to receiving a heartbeat to acknowledge that it has been received.
9090
/// </summary>
91-
HeartbeatAcknowledge = 11
91+
HeartbeatAcknowledge = 11,
92+
93+
/// <summary>
94+
/// Request information about soundboard sounds in guilds.
95+
/// </summary>
96+
RequestSoundboardSounds = 31
9297
}

Backend/Remora.Discord.API.Abstractions/API/Objects/AuditLogs/AuditLogEvent.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,21 @@ public enum AuditLogEvent
270270
/// </summary>
271271
ApplicationCommandPermissionUpdate = 121,
272272

273+
/// <summary>
274+
/// A soundboard sound was created.
275+
/// </summary>
276+
SoundboardSoundCreate = 130,
277+
278+
/// <summary>
279+
/// A soundboard sound was updated.
280+
/// </summary>
281+
SoundboardSoundUpdate = 131,
282+
283+
/// <summary>
284+
/// A soundboard sound was deleted.
285+
/// </summary>
286+
SoundboardSoundDelete = 132,
287+
273288
/// <summary>
274289
/// An Auto Moderation rule was created.
275290
/// </summary>

Backend/Remora.Discord.API.Abstractions/API/Objects/Guilds/GuildFeature.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ public enum GuildFeature
100100
/// </summary>
101101
MemberVerificationGateEnabled,
102102

103+
/// <summary>
104+
/// The guild has increased custom soundboard sound slots.
105+
/// </summary>
106+
MoreSoundboard,
107+
103108
/// <summary>
104109
/// The guild has enabled monetization.
105110
/// </summary>
@@ -145,6 +150,11 @@ public enum GuildFeature
145150
/// </summary>
146151
RoleSubscriptionsEnabled,
147152

153+
/// <summary>
154+
/// The guild has created soundboard sounds.
155+
/// </summary>
156+
Soundboard,
157+
148158
/// <summary>
149159
/// The guild has enabled ticketed events.
150160
/// </summary>

0 commit comments

Comments
 (0)