diff --git a/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuCooldownAttribute.cs b/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuCooldownAttribute.cs
index a5475c6f9..07164ced3 100644
--- a/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuCooldownAttribute.cs
+++ b/DisCatSharp.ApplicationCommands/Attributes/ContextMenu/ContextMenuCooldownAttribute.cs
@@ -1,156 +1,157 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using DisCatSharp.ApplicationCommands.Context;
using DisCatSharp.ApplicationCommands.Entities;
using DisCatSharp.ApplicationCommands.Enums;
namespace DisCatSharp.ApplicationCommands.Attributes;
///
/// Defines a cooldown for this command. This allows you to define how many times can users execute a specific command
///
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public sealed class ContextMenuCooldownAttribute : ContextMenuCheckBaseAttribute, ICooldown
{
///
/// Gets the maximum number of uses before this command triggers a cooldown for its bucket.
///
public int MaxUses { get; }
///
/// Gets the time after which the cooldown is reset.
///
public TimeSpan Reset { get; }
///
/// Gets the type of the cooldown bucket. This determines how cooldowns are applied.
///
public CooldownBucketType BucketType { get; }
///
/// Gets the cooldown buckets for this command.
///
+ // ReSharper disable once InconsistentNaming
internal readonly ConcurrentDictionary _buckets;
///
/// Defines a cooldown for this command. This means that users will be able to use the command a specific number of times before they have to wait to use it again.
///
/// Number of times the command can be used before triggering a cooldown.
/// Number of seconds after which the cooldown is reset.
/// Type of cooldown bucket. This allows controlling whether the bucket will be cooled down per user, guild, channel, or globally.
public ContextMenuCooldownAttribute(int maxUses, double resetAfter, CooldownBucketType bucketType)
{
this.MaxUses = maxUses;
this.Reset = TimeSpan.FromSeconds(resetAfter);
this.BucketType = bucketType;
this._buckets = new ConcurrentDictionary();
}
///
/// Gets a cooldown bucket for given command context.
///
/// Command context to get cooldown bucket for.
/// Requested cooldown bucket, or null if one wasn't present.
public ContextMenuCooldownBucket GetBucket(ContextMenuContext ctx)
{
var bid = this.GetBucketId(ctx, out _, out _, out _);
this._buckets.TryGetValue(bid, out var bucket);
return bucket;
}
///
/// Calculates the cooldown remaining for given command context.
///
/// Context for which to calculate the cooldown.
/// Remaining cooldown, or zero if no cooldown is active.
public TimeSpan GetRemainingCooldown(ContextMenuContext ctx)
{
var bucket = this.GetBucket(ctx);
return bucket == null ? TimeSpan.Zero : bucket.RemainingUses > 0 ? TimeSpan.Zero : bucket.ResetsAt - DateTimeOffset.UtcNow;
}
///
/// Calculates bucket ID for given command context.
///
/// Context for which to calculate bucket ID for.
/// ID of the user with which this bucket is associated.
/// ID of the channel with which this bucket is associated.
/// ID of the guild with which this bucket is associated.
/// Calculated bucket ID.
private string GetBucketId(ContextMenuContext ctx, out ulong userId, out ulong channelId, out ulong guildId)
{
userId = 0ul;
if ((this.BucketType & CooldownBucketType.User) != 0)
userId = ctx.User.Id;
channelId = 0ul;
if ((this.BucketType & CooldownBucketType.Channel) != 0)
channelId = ctx.Channel.Id;
if ((this.BucketType & CooldownBucketType.Guild) != 0 && ctx.Guild == null)
channelId = ctx.Channel.Id;
guildId = 0ul;
if (ctx.Guild != null && (this.BucketType & CooldownBucketType.Guild) != 0)
guildId = ctx.Guild.Id;
var bid = CooldownBucket.MakeId(userId, channelId, guildId);
return bid;
}
///
/// Executes a check.
///
/// The command context.
public override async Task ExecuteChecksAsync(ContextMenuContext ctx)
{
var bid = this.GetBucketId(ctx, out var usr, out var chn, out var gld);
if (!this._buckets.TryGetValue(bid, out var bucket))
{
bucket = new ContextMenuCooldownBucket(this.MaxUses, this.Reset, usr, chn, gld);
this._buckets.AddOrUpdate(bid, bucket, (k, v) => bucket);
}
return await bucket.DecrementUseAsync().ConfigureAwait(false);
}
}
///
/// Represents a cooldown bucket for commands.
///
public sealed class ContextMenuCooldownBucket : CooldownBucket
{
internal ContextMenuCooldownBucket(int maxUses, TimeSpan resetAfter, ulong userId = 0, ulong channelId = 0, ulong guildId = 0)
: base(maxUses, resetAfter, userId, channelId, guildId)
{
}
///
/// Returns a string representation of this command cooldown bucket.
///
/// String representation of this command cooldown bucket.
public override string ToString() => $"Context Menu Command bucket {this.BucketId}";
}
diff --git a/DisCatSharp.ApplicationCommands/DisCatSharp.ApplicationCommands.csproj b/DisCatSharp.ApplicationCommands/DisCatSharp.ApplicationCommands.csproj
index 61ec08f77..659089fab 100644
--- a/DisCatSharp.ApplicationCommands/DisCatSharp.ApplicationCommands.csproj
+++ b/DisCatSharp.ApplicationCommands/DisCatSharp.ApplicationCommands.csproj
@@ -1,32 +1,32 @@
DisCatSharp.ApplicationCommands
DisCatSharp.ApplicationCommands
DisCatSharp.ApplicationCommands
ApplicationCommands for DisCatSharp
discord, discord-api, bots, discord-bots, chat, dcs, discatsharp, csharp, dotnet, vb-net, fsharp, slash, slashcommands, contextmenu
-
-
+
+
diff --git a/DisCatSharp.ApplicationCommands/Entities/CooldownBucket.cs b/DisCatSharp.ApplicationCommands/Entities/CooldownBucket.cs
index b43cef26e..c9cf08bd9 100644
--- a/DisCatSharp.ApplicationCommands/Entities/CooldownBucket.cs
+++ b/DisCatSharp.ApplicationCommands/Entities/CooldownBucket.cs
@@ -1,186 +1,187 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
namespace DisCatSharp.ApplicationCommands.Entities;
public class CooldownBucket : IBucket, IEquatable
{
///
/// The user id for this bucket.
///
public ulong UserId { get; }
///
/// The channel id for this bucket.
///
public ulong ChannelId { get; }
///
/// The guild id for this bucket.
///
public ulong GuildId { get; }
///
/// The id for this bucket.
///
public string BucketId { get; }
///
/// The remaining uses for this bucket.
///
public int RemainingUses => Volatile.Read(ref this._remainingUses);
///
/// The max uses for this bucket.
///
public int MaxUses { get; }
///
/// The datetime offset when this bucket resets.
///
public DateTimeOffset ResetsAt { get; internal set; }
///
/// The timespan when this bucket resets.
///
public TimeSpan Reset { get; internal set; }
///
/// Gets the semaphore used to lock the use value.
///
- internal readonly SemaphoreSlim _usageSemaphore;
+ internal readonly SemaphoreSlim UsageSemaphore;
+ // ReSharper disable once InconsistentNaming
internal int _remainingUses;
///
/// Creates a new command cooldown bucket.
///
/// Maximum number of uses for this bucket.
/// Time after which this bucket resets.
/// ID of the user with which this cooldown is associated.
/// ID of the channel with which this cooldown is associated.
/// ID of the guild with which this cooldown is associated.
internal CooldownBucket(int maxUses, TimeSpan resetAfter, ulong userId = 0, ulong channelId = 0, ulong guildId = 0)
{
this._remainingUses = maxUses;
this.MaxUses = maxUses;
this.ResetsAt = DateTimeOffset.UtcNow + resetAfter;
this.Reset = resetAfter;
this.UserId = userId;
this.ChannelId = channelId;
this.GuildId = guildId;
this.BucketId = MakeId(userId, channelId, guildId);
- this._usageSemaphore = new(1, 1);
+ this.UsageSemaphore = new(1, 1);
}
///
/// Decrements the remaining use counter.
///
/// Whether decrement succeeded or not.
internal async Task DecrementUseAsync()
{
- await this._usageSemaphore.WaitAsync().ConfigureAwait(false);
+ await this.UsageSemaphore.WaitAsync().ConfigureAwait(false);
Console.WriteLine($"[DecrementUseAsync]: Remaining: {this.RemainingUses}/{this.MaxUses} Resets: {this.ResetsAt} Now: {DateTimeOffset.UtcNow} Vars[u,c,g]: {this.UserId} {this.ChannelId} {this.GuildId} Id: {this.BucketId}");
// if we're past reset time...
var now = DateTimeOffset.UtcNow;
if (now >= this.ResetsAt)
{
// ...do the reset and set a new reset time
Interlocked.Exchange(ref this._remainingUses, this.MaxUses);
this.ResetsAt = now + this.Reset;
}
// check if we have any uses left, if we do...
var success = false;
if (this.RemainingUses > 0)
{
// ...decrement, and return success...
Interlocked.Decrement(ref this._remainingUses);
success = true;
}
Console.WriteLine($"[DecrementUseAsync]: Remaining: {this.RemainingUses}/{this.MaxUses} Resets: {this.ResetsAt} Now: {DateTimeOffset.UtcNow} Vars[u,c,g]: {this.UserId} {this.ChannelId} {this.GuildId} Id: {this.BucketId}");
// ...otherwise just fail
- this._usageSemaphore.Release();
+ this.UsageSemaphore.Release();
return success;
}
///
/// Checks whether this is equal to another object.
///
/// Object to compare to.
/// Whether the object is equal to this .
public override bool Equals(object obj) => this.Equals(obj as CooldownBucket);
///
/// Checks whether this is equal to another .
///
/// to compare to.
/// Whether the is equal to this .
public bool Equals(CooldownBucket other) => other is not null && (ReferenceEquals(this, other) || (this.UserId == other.UserId && this.ChannelId == other.ChannelId && this.GuildId == other.GuildId));
///
/// Gets the hash code for this .
///
/// The hash code for this .
public override int GetHashCode() => HashCode.Combine(this.UserId, this.ChannelId, this.GuildId);
///
/// Gets whether the two objects are equal.
///
/// First bucket to compare.
/// Second bucket to compare.
/// Whether the two buckets are equal.
public static bool operator ==(CooldownBucket bucket1, CooldownBucket bucket2)
{
var null1 = bucket1 is null;
var null2 = bucket2 is null;
return (null1 && null2) || (null1 == null2 && null1.Equals(null2));
}
///
/// Gets whether the two objects are not equal.
///
/// First bucket to compare.
/// Second bucket to compare.
/// Whether the two buckets are not equal.
public static bool operator !=(CooldownBucket bucket1, CooldownBucket bucket2)
=> !(bucket1 == bucket2);
///
/// Creates a bucket ID from given bucket parameters.
///
/// ID of the user with which this cooldown is associated.
/// ID of the channel with which this cooldown is associated.
/// ID of the guild with which this cooldown is associated.
/// Generated bucket ID.
public static string MakeId(ulong userId = 0, ulong channelId = 0, ulong guildId = 0)
=> $"{userId.ToString(CultureInfo.InvariantCulture)}:{channelId.ToString(CultureInfo.InvariantCulture)}:{guildId.ToString(CultureInfo.InvariantCulture)}";
}
diff --git a/DisCatSharp.ApplicationCommands/global.json b/DisCatSharp.ApplicationCommands/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.ApplicationCommands/global.json
+++ b/DisCatSharp.ApplicationCommands/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.CommandsNext/DisCatSharp.CommandsNext.csproj b/DisCatSharp.CommandsNext/DisCatSharp.CommandsNext.csproj
index 46aceab9a..c8d49cb55 100644
--- a/DisCatSharp.CommandsNext/DisCatSharp.CommandsNext.csproj
+++ b/DisCatSharp.CommandsNext/DisCatSharp.CommandsNext.csproj
@@ -1,31 +1,31 @@
DisCatSharp.CommandsNext
DisCatSharp.CommandsNext
DisCatSharp.CommandsNext
CommandNext extension for DisCatSharp.
discord, discord-api, bots, discord-bots, chat, dcs, discatsharp, csharp, dotnet, vb-net, fsharp, commands, commandsnext
-
+
diff --git a/DisCatSharp.CommandsNext/global.json b/DisCatSharp.CommandsNext/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.CommandsNext/global.json
+++ b/DisCatSharp.CommandsNext/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.Common/DisCatSharp.Common.csproj b/DisCatSharp.Common/DisCatSharp.Common.csproj
index 097cfbfec..3c1e10d5c 100644
--- a/DisCatSharp.Common/DisCatSharp.Common.csproj
+++ b/DisCatSharp.Common/DisCatSharp.Common.csproj
@@ -1,38 +1,38 @@
DisCatSharp.Common
DisCatSharp.Common
True
True
True
Portable
DisCatSharp.Common
Assortment of various common types and utilities for DisCatSharp's projects.
common utilities dotnet dotnet-core dotnetfx netfx netcore csharp
enable
False
-
-
+
+
diff --git a/DisCatSharp.Common/global.json b/DisCatSharp.Common/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.Common/global.json
+++ b/DisCatSharp.Common/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.Configuration.Tests/DisCatSharp.Configuration.Tests.csproj b/DisCatSharp.Configuration.Tests/DisCatSharp.Configuration.Tests.csproj
index 6ef860ba3..24e0ccf13 100644
--- a/DisCatSharp.Configuration.Tests/DisCatSharp.Configuration.Tests.csproj
+++ b/DisCatSharp.Configuration.Tests/DisCatSharp.Configuration.Tests.csproj
@@ -1,53 +1,53 @@
- net6.0
+ net7.0
enable
1591;NU5128;DV2001
false
false
runtime; build; native; contentfiles; analyzers; buildtransitive
all
runtime; build; native; contentfiles; analyzers; buildtransitive
all
Always
Always
Always
Always
Always
Always
diff --git a/DisCatSharp.Configuration.Tests/global.json b/DisCatSharp.Configuration.Tests/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.Configuration.Tests/global.json
+++ b/DisCatSharp.Configuration.Tests/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.Configuration/DisCatSharp.Configuration.csproj b/DisCatSharp.Configuration/DisCatSharp.Configuration.csproj
index f4618a4d9..412cb7512 100644
--- a/DisCatSharp.Configuration/DisCatSharp.Configuration.csproj
+++ b/DisCatSharp.Configuration/DisCatSharp.Configuration.csproj
@@ -1,34 +1,34 @@
- net6.0
+ net7.0
enable
DisCatSharp.Configuration
DisCatSharp.Configuration
True
DisCatSharp.Configuration
Configuration for DisCatSharp.
discord, discord-api, bots, discord-bots, net-sdk, dcs, discatsharp, csharp, dotnet, vb-net, fsharp
diff --git a/DisCatSharp.Configuration/global.json b/DisCatSharp.Configuration/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.Configuration/global.json
+++ b/DisCatSharp.Configuration/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.Hosting.DependencyInjection/DisCatSharp.Hosting.DependencyInjection.csproj b/DisCatSharp.Hosting.DependencyInjection/DisCatSharp.Hosting.DependencyInjection.csproj
index edbb9056a..0325cc6fe 100644
--- a/DisCatSharp.Hosting.DependencyInjection/DisCatSharp.Hosting.DependencyInjection.csproj
+++ b/DisCatSharp.Hosting.DependencyInjection/DisCatSharp.Hosting.DependencyInjection.csproj
@@ -1,29 +1,29 @@
-
+
- net6.0
+ net7.0
enable
True
DisCatSharp.Hosting.DependencyInjection
Dependency Injection for DisCatSharp.Hosting.
discord, discord-api, bots, discord-bots, net-sdk, dcs, discatsharp, csharp, dotnet, vb-net, fsharp
diff --git a/DisCatSharp.Hosting.DependencyInjection/global.json b/DisCatSharp.Hosting.DependencyInjection/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.Hosting.DependencyInjection/global.json
+++ b/DisCatSharp.Hosting.DependencyInjection/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.Hosting.Tests/DisCatSharp.Hosting.Tests.csproj b/DisCatSharp.Hosting.Tests/DisCatSharp.Hosting.Tests.csproj
index 2c90cdb20..a6ef565fa 100644
--- a/DisCatSharp.Hosting.Tests/DisCatSharp.Hosting.Tests.csproj
+++ b/DisCatSharp.Hosting.Tests/DisCatSharp.Hosting.Tests.csproj
@@ -1,49 +1,49 @@
- net6.0
+ net7.0
enable
1591;NU5128;DV2001
false
false
runtime; build; native; contentfiles; analyzers; buildtransitive
all
runtime; build; native; contentfiles; analyzers; buildtransitive
all
Always
Always
Always
Always
diff --git a/DisCatSharp.Hosting.Tests/global.json b/DisCatSharp.Hosting.Tests/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.Hosting.Tests/global.json
+++ b/DisCatSharp.Hosting.Tests/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.Hosting/DisCatSharp.Hosting.csproj b/DisCatSharp.Hosting/DisCatSharp.Hosting.csproj
index 1b42203af..3081411a2 100644
--- a/DisCatSharp.Hosting/DisCatSharp.Hosting.csproj
+++ b/DisCatSharp.Hosting/DisCatSharp.Hosting.csproj
@@ -1,31 +1,31 @@
-
+
- net6.0
+ net7.0
enable
True
DisCatSharp.Hosting
Hosting for DisCatSharp.
discord, discord-api, bots, discord-bots, net-sdk, dcs, discatsharp, csharp, dotnet, vb-net, fsharp
diff --git a/DisCatSharp.Hosting/global.json b/DisCatSharp.Hosting/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.Hosting/global.json
+++ b/DisCatSharp.Hosting/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.Interactivity/DisCatSharp.Interactivity.csproj b/DisCatSharp.Interactivity/DisCatSharp.Interactivity.csproj
index d3a703399..700a4a21c 100644
--- a/DisCatSharp.Interactivity/DisCatSharp.Interactivity.csproj
+++ b/DisCatSharp.Interactivity/DisCatSharp.Interactivity.csproj
@@ -1,31 +1,31 @@
DisCatSharp.Interactivity
DisCatSharp.Interactivity
DisCatSharp.Interactivity
Interactivity extension for DisCatSharp.
discord, discord-api, bots, discord-bots, chat, dcs, discatsharp, csharp, dotnet, vb-net, fsharp, interactive, pagination, reactions
-
+
diff --git a/DisCatSharp.Interactivity/global.json b/DisCatSharp.Interactivity/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.Interactivity/global.json
+++ b/DisCatSharp.Interactivity/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.Lavalink/DisCatSharp.Lavalink.csproj b/DisCatSharp.Lavalink/DisCatSharp.Lavalink.csproj
index 0b5ab864f..154d9eabf 100644
--- a/DisCatSharp.Lavalink/DisCatSharp.Lavalink.csproj
+++ b/DisCatSharp.Lavalink/DisCatSharp.Lavalink.csproj
@@ -1,31 +1,31 @@
DisCatSharp.Lavalink
DisCatSharp.Lavalink
true
DisCatSharp.Lavalink
Lavalink implementation for DisCatSharp.
discord, discord-api, bots, discord-bots, chat, dcs, discatsharp, csharp, dotnet, vb-net, fsharp, audio, voice, radio, music, lavalink, lavaplayer
-
+
diff --git a/DisCatSharp.Lavalink/global.json b/DisCatSharp.Lavalink/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.Lavalink/global.json
+++ b/DisCatSharp.Lavalink/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.VoiceNext.Natives/DisCatSharp.VoiceNext.Natives.csproj b/DisCatSharp.VoiceNext.Natives/DisCatSharp.VoiceNext.Natives.csproj
index fb247669f..91ba44e69 100644
--- a/DisCatSharp.VoiceNext.Natives/DisCatSharp.VoiceNext.Natives.csproj
+++ b/DisCatSharp.VoiceNext.Natives/DisCatSharp.VoiceNext.Natives.csproj
@@ -1,36 +1,36 @@
- net6.0
+ net7.0
false
win-x86;win-x64
true
false
symbols.nupkg
DisCatSharp.VoiceNext.Natives
Voice Natives for DisCatSharp.
discord, discord-api, bots, discord-bots, chat, dcs, discatsharp, csharp, dotnet, vb-net, fsharp, audio, voice, radio, music
true
runtimes
diff --git a/DisCatSharp.VoiceNext.Natives/global.json b/DisCatSharp.VoiceNext.Natives/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.VoiceNext.Natives/global.json
+++ b/DisCatSharp.VoiceNext.Natives/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp.VoiceNext/DisCatSharp.VoiceNext.csproj b/DisCatSharp.VoiceNext/DisCatSharp.VoiceNext.csproj
index e27724095..6ee617410 100644
--- a/DisCatSharp.VoiceNext/DisCatSharp.VoiceNext.csproj
+++ b/DisCatSharp.VoiceNext/DisCatSharp.VoiceNext.csproj
@@ -1,36 +1,36 @@
DisCatSharp.VoiceNext
DisCatSharp.VoiceNext
true
DisCatSharp.VoiceNext
Voice extension for DisCatSharp.
discord, discord-api, bots, discord-bots, chat, dcs, discatsharp, csharp, dotnet, vb-net, fsharp, audio, voice, radio, music
-
-
+
+
diff --git a/DisCatSharp.VoiceNext/global.json b/DisCatSharp.VoiceNext/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp.VoiceNext/global.json
+++ b/DisCatSharp.VoiceNext/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/DisCatSharp/Clients/DiscordClient.Events.cs b/DisCatSharp/Clients/DiscordClient.Events.cs
index 8dc14d763..d2fd006ed 100644
--- a/DisCatSharp/Clients/DiscordClient.Events.cs
+++ b/DisCatSharp/Clients/DiscordClient.Events.cs
@@ -1,1025 +1,1026 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2021-2022 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
using System;
using DisCatSharp.Common.Utilities;
using DisCatSharp.EventArgs;
using Microsoft.Extensions.Logging;
namespace DisCatSharp;
///
/// Represents a discord client.
///
public sealed partial class DiscordClient
{
///
/// Gets the event execution limit.
///
internal static TimeSpan EventExecutionLimit { get; } = TimeSpan.FromSeconds(1);
#region WebSocket
///
/// Fired whenever a WebSocket error occurs within the client.
///
public event AsyncEventHandler SocketErrored
{
add => this._socketErrored.Register(value);
remove => this._socketErrored.Unregister(value);
}
private AsyncEvent _socketErrored;
///
/// Fired whenever WebSocket connection is established.
///
public event AsyncEventHandler SocketOpened
{
add => this._socketOpened.Register(value);
remove => this._socketOpened.Unregister(value);
}
private AsyncEvent _socketOpened;
///
/// Fired whenever WebSocket connection is terminated.
///
public event AsyncEventHandler SocketClosed
{
add => this._socketClosed.Register(value);
remove => this._socketClosed.Unregister(value);
}
private AsyncEvent _socketClosed;
///
/// Fired when the client enters ready state.
///
public event AsyncEventHandler Ready
{
add => this._ready.Register(value);
remove => this._ready.Unregister(value);
}
private AsyncEvent _ready;
///
/// Fired whenever a session is resumed.
///
public event AsyncEventHandler Resumed
{
add => this._resumed.Register(value);
remove => this._resumed.Unregister(value);
}
private AsyncEvent _resumed;
///
/// Fired on received heartbeat ACK.
///
public event AsyncEventHandler Heartbeated
{
add => this._heartbeated.Register(value);
remove => this._heartbeated.Unregister(value);
}
private AsyncEvent _heartbeated;
#endregion
#region Channel
///
/// Fired when a new channel is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelCreated
{
add => this._channelCreated.Register(value);
remove => this._channelCreated.Unregister(value);
}
private AsyncEvent _channelCreated;
///
/// Fired when a channel is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelUpdated
{
add => this._channelUpdated.Register(value);
remove => this._channelUpdated.Unregister(value);
}
private AsyncEvent _channelUpdated;
///
/// Fired when a channel is deleted
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelDeleted
{
add => this._channelDeleted.Register(value);
remove => this._channelDeleted.Unregister(value);
}
private AsyncEvent _channelDeleted;
///
/// Fired when a dm channel is deleted
/// For this Event you need the intent specified in
///
public event AsyncEventHandler DmChannelDeleted
{
add => this._dmChannelDeleted.Register(value);
remove => this._dmChannelDeleted.Unregister(value);
}
private AsyncEvent _dmChannelDeleted;
///
/// Fired whenever a channel's pinned message list is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ChannelPinsUpdated
{
add => this._channelPinsUpdated.Register(value);
remove => this._channelPinsUpdated.Unregister(value);
}
private AsyncEvent _channelPinsUpdated;
#endregion
#region Guild
///
/// Fired when the user joins a new guild.
/// For this Event you need the intent specified in
///
/// [alias="GuildJoined"][alias="JoinedGuild"]
public event AsyncEventHandler GuildCreated
{
add => this._guildCreated.Register(value);
remove => this._guildCreated.Unregister(value);
}
private AsyncEvent _guildCreated;
///
/// Fired when a guild is becoming available.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildAvailable
{
add => this._guildAvailable.Register(value);
remove => this._guildAvailable.Unregister(value);
}
private AsyncEvent _guildAvailable;
///
/// Fired when a guild is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildUpdated
{
add => this._guildUpdated.Register(value);
remove => this._guildUpdated.Unregister(value);
}
private AsyncEvent _guildUpdated;
///
/// Fired when the user leaves or is removed from a guild.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildDeleted
{
add => this._guildDeleted.Register(value);
remove => this._guildDeleted.Unregister(value);
}
private AsyncEvent _guildDeleted;
///
/// Fired when a guild becomes unavailable.
///
public event AsyncEventHandler GuildUnavailable
{
add => this._guildUnavailable.Register(value);
remove => this._guildUnavailable.Unregister(value);
}
private AsyncEvent _guildUnavailable;
///
/// Fired when all guilds finish streaming from Discord.
///
public event AsyncEventHandler GuildDownloadCompleted
{
add => this._guildDownloadCompletedEv.Register(value);
remove => this._guildDownloadCompletedEv.Unregister(value);
}
private AsyncEvent _guildDownloadCompletedEv;
///
/// Fired when a guilds emojis get updated
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildEmojisUpdated
{
add => this._guildEmojisUpdated.Register(value);
remove => this._guildEmojisUpdated.Unregister(value);
}
private AsyncEvent _guildEmojisUpdated;
///
/// Fired when a guilds stickers get updated
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildStickersUpdated
{
add => this._guildStickersUpdated.Register(value);
remove => this._guildStickersUpdated.Unregister(value);
}
private AsyncEvent _guildStickersUpdated;
///
/// Fired when a guild integration is updated.
///
public event AsyncEventHandler GuildIntegrationsUpdated
{
add => this._guildIntegrationsUpdated.Register(value);
remove => this._guildIntegrationsUpdated.Unregister(value);
}
private AsyncEvent _guildIntegrationsUpdated;
#endregion
#region Guild Ban
///
/// Fired when a guild ban gets added
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildBanAdded
{
add => this._guildBanAdded.Register(value);
remove => this._guildBanAdded.Unregister(value);
}
private AsyncEvent _guildBanAdded;
///
/// Fired when a guild ban gets removed
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildBanRemoved
{
add => this._guildBanRemoved.Register(value);
remove => this._guildBanRemoved.Unregister(value);
}
private AsyncEvent _guildBanRemoved;
#endregion
#region Guild Timeout
///
/// Fired when a guild member timeout gets added.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberTimeoutAdded
{
add => this._guildMemberTimeoutAdded.Register(value);
remove => this._guildMemberTimeoutAdded.Unregister(value);
}
private AsyncEvent _guildMemberTimeoutAdded;
///
/// Fired when a guild member timeout gets changed.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberTimeoutChanged
{
add => this._guildMemberTimeoutChanged.Register(value);
remove => this._guildMemberTimeoutChanged.Unregister(value);
}
private AsyncEvent _guildMemberTimeoutChanged;
///
/// Fired when a guild member timeout gets removed.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberTimeoutRemoved
{
add => this._guildMemberTimeoutRemoved.Register(value);
remove => this._guildMemberTimeoutRemoved.Unregister(value);
}
private AsyncEvent _guildMemberTimeoutRemoved;
#endregion
#region Guild Scheduled Event
///
/// Fired when a scheduled Event is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventCreated
{
add => this._guildScheduledEventCreated.Register(value);
remove => this._guildScheduledEventCreated.Unregister(value);
}
private AsyncEvent _guildScheduledEventCreated;
///
/// Fired when a scheduled Event is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventUpdated
{
add => this._guildScheduledEventUpdated.Register(value);
remove => this._guildScheduledEventUpdated.Unregister(value);
}
private AsyncEvent _guildScheduledEventUpdated;
///
/// Fired when a scheduled Event is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventDeleted
{
add => this._guildScheduledEventDeleted.Register(value);
remove => this._guildScheduledEventDeleted.Unregister(value);
}
private AsyncEvent _guildScheduledEventDeleted;
///
/// Fired when a user subscribes to a scheduled event.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventUserAdded
{
add => this._guildScheduledEventUserAdded.Register(value);
remove => this._guildScheduledEventUserAdded.Unregister(value);
}
private AsyncEvent _guildScheduledEventUserAdded;
///
/// Fired when a user unsubscribes from a scheduled event.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildScheduledEventUserRemoved
{
add => this._guildScheduledEventUserRemoved.Register(value);
remove => this._guildScheduledEventUserRemoved.Unregister(value);
}
private AsyncEvent _guildScheduledEventUserRemoved;
#endregion
#region Guild Integration
///
/// Fired when a guild integration is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildIntegrationCreated
{
add => this._guildIntegrationCreated.Register(value);
remove => this._guildIntegrationCreated.Unregister(value);
}
private AsyncEvent _guildIntegrationCreated;
///
/// Fired when a guild integration is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildIntegrationUpdated
{
add => this._guildIntegrationUpdated.Register(value);
remove => this._guildIntegrationUpdated.Unregister(value);
}
private AsyncEvent _guildIntegrationUpdated;
///
/// Fired when a guild integration is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildIntegrationDeleted
{
add => this._guildIntegrationDeleted.Register(value);
remove => this._guildIntegrationDeleted.Unregister(value);
}
private AsyncEvent _guildIntegrationDeleted;
#endregion
#region Guild Member
///
/// Fired when a new user joins a guild.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberAdded
{
add => this._guildMemberAdded.Register(value);
remove => this._guildMemberAdded.Unregister(value);
}
private AsyncEvent _guildMemberAdded;
///
/// Fired when a user is removed from a guild (leave/kick/ban).
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberRemoved
{
add => this._guildMemberRemoved.Register(value);
remove => this._guildMemberRemoved.Unregister(value);
}
private AsyncEvent _guildMemberRemoved;
///
/// Fired when a guild member is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildMemberUpdated
{
add => this._guildMemberUpdated.Register(value);
remove => this._guildMemberUpdated.Unregister(value);
}
private AsyncEvent _guildMemberUpdated;
///
/// Fired in response to Gateway Request Guild Members.
///
public event AsyncEventHandler GuildMembersChunked
{
add => this._guildMembersChunked.Register(value);
remove => this._guildMembersChunked.Unregister(value);
}
private AsyncEvent _guildMembersChunked;
#endregion
#region Guild Role
///
/// Fired when a guild role is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildRoleCreated
{
add => this._guildRoleCreated.Register(value);
remove => this._guildRoleCreated.Unregister(value);
}
private AsyncEvent _guildRoleCreated;
///
/// Fired when a guild role is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildRoleUpdated
{
add => this._guildRoleUpdated.Register(value);
remove => this._guildRoleUpdated.Unregister(value);
}
private AsyncEvent _guildRoleUpdated;
///
/// Fired when a guild role is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler GuildRoleDeleted
{
add => this._guildRoleDeleted.Register(value);
remove => this._guildRoleDeleted.Unregister(value);
}
private AsyncEvent _guildRoleDeleted;
#endregion
#region Invite
///
/// Fired when an invite is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler InviteCreated
{
add => this._inviteCreated.Register(value);
remove => this._inviteCreated.Unregister(value);
}
private AsyncEvent _inviteCreated;
///
/// Fired when an invite is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler InviteDeleted
{
add => this._inviteDeleted.Register(value);
remove => this._inviteDeleted.Unregister(value);
}
private AsyncEvent _inviteDeleted;
#endregion
#region Message
///
/// Fired when a message is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageCreated
{
add => this._messageCreated.Register(value);
remove => this._messageCreated.Unregister(value);
}
private AsyncEvent _messageCreated;
///
/// Fired when message is acknowledged by the user.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageAcknowledged
{
add => this._messageAcknowledged.Register(value);
remove => this._messageAcknowledged.Unregister(value);
}
private AsyncEvent _messageAcknowledged;
///
/// Fired when a message is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageUpdated
{
add => this._messageUpdated.Register(value);
remove => this._messageUpdated.Unregister(value);
}
private AsyncEvent _messageUpdated;
///
/// Fired when a message is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageDeleted
{
add => this._messageDeleted.Register(value);
remove => this._messageDeleted.Unregister(value);
}
private AsyncEvent _messageDeleted;
///
/// Fired when multiple messages are deleted at once.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessagesBulkDeleted
{
add => this._messagesBulkDeleted.Register(value);
remove => this._messagesBulkDeleted.Unregister(value);
}
private AsyncEvent _messagesBulkDeleted;
#endregion
#region Message Reaction
///
/// Fired when a reaction gets added to a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionAdded
{
add => this._messageReactionAdded.Register(value);
remove => this._messageReactionAdded.Unregister(value);
}
private AsyncEvent _messageReactionAdded;
///
/// Fired when a reaction gets removed from a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionRemoved
{
add => this._messageReactionRemoved.Register(value);
remove => this._messageReactionRemoved.Unregister(value);
}
private AsyncEvent _messageReactionRemoved;
///
/// Fired when all reactions get removed from a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionsCleared
{
add => this._messageReactionsCleared.Register(value);
remove => this._messageReactionsCleared.Unregister(value);
}
private AsyncEvent _messageReactionsCleared;
///
/// Fired when all reactions of a specific reaction are removed from a message.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler MessageReactionRemovedEmoji
{
add => this._messageReactionRemovedEmoji.Register(value);
remove => this._messageReactionRemovedEmoji.Unregister(value);
}
private AsyncEvent _messageReactionRemovedEmoji;
#endregion
#region Activities
///
/// Fired when a embedded activity has been updated.
///
public event AsyncEventHandler EmbeddedActivityUpdated
{
add => this._embeddedActivityUpdated.Register(value);
remove => this._embeddedActivityUpdated.Unregister(value);
}
private AsyncEvent _embeddedActivityUpdated;
#endregion
#region Presence/User Update
///
/// Fired when a presence has been updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler PresenceUpdated
{
add => this._presenceUpdated.Register(value);
remove => this._presenceUpdated.Unregister(value);
}
private AsyncEvent _presenceUpdated;
///
/// Fired when the current user updates their settings.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler UserSettingsUpdated
{
add => this._userSettingsUpdated.Register(value);
remove => this._userSettingsUpdated.Unregister(value);
}
private AsyncEvent _userSettingsUpdated;
///
/// Fired when properties about the current user change.
///
///
/// NB: This event only applies for changes to the current user, the client that is connected to Discord.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler UserUpdated
{
add => this._userUpdated.Register(value);
remove => this._userUpdated.Unregister(value);
}
private AsyncEvent _userUpdated;
#endregion
#region Stage Instance
///
/// Fired when a Stage Instance is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler StageInstanceCreated
{
add => this._stageInstanceCreated.Register(value);
remove => this._stageInstanceCreated.Unregister(value);
}
private AsyncEvent _stageInstanceCreated;
///
/// Fired when a Stage Instance is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler StageInstanceUpdated
{
add => this._stageInstanceUpdated.Register(value);
remove => this._stageInstanceUpdated.Unregister(value);
}
private AsyncEvent _stageInstanceUpdated;
///
/// Fired when a Stage Instance is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler StageInstanceDeleted
{
add => this._stageInstanceDeleted.Register(value);
remove => this._stageInstanceDeleted.Unregister(value);
}
private AsyncEvent _stageInstanceDeleted;
#endregion
#region Thread
///
/// Fired when a thread is created.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadCreated
{
add => this._threadCreated.Register(value);
remove => this._threadCreated.Unregister(value);
}
private AsyncEvent _threadCreated;
///
/// Fired when a thread is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadUpdated
{
add => this._threadUpdated.Register(value);
remove => this._threadUpdated.Unregister(value);
}
private AsyncEvent _threadUpdated;
///
/// Fired when a thread is deleted.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadDeleted
{
add => this._threadDeleted.Register(value);
remove => this._threadDeleted.Unregister(value);
}
private AsyncEvent _threadDeleted;
///
/// Fired when a thread member is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadListSynced
{
add => this._threadListSynced.Register(value);
remove => this._threadListSynced.Unregister(value);
}
private AsyncEvent _threadListSynced;
///
/// Fired when a thread member is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler ThreadMemberUpdated
{
add => this._threadMemberUpdated.Register(value);
remove => this._threadMemberUpdated.Unregister(value);
}
private AsyncEvent _threadMemberUpdated;
///
/// Fired when the thread members are updated.
/// For this Event you need the or intent specified in
///
public event AsyncEventHandler ThreadMembersUpdated
{
add => this._threadMembersUpdated.Register(value);
remove => this._threadMembersUpdated.Unregister(value);
}
private AsyncEvent _threadMembersUpdated;
#endregion
#region Voice
///
/// Fired when someone joins/leaves/moves voice channels.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler VoiceStateUpdated
{
add => this._voiceStateUpdated.Register(value);
remove => this._voiceStateUpdated.Unregister(value);
}
private AsyncEvent _voiceStateUpdated;
///
/// Fired when a guild's voice server is updated.
/// For this Event you need the intent specified in
///
public event AsyncEventHandler VoiceServerUpdated
{
add => this._voiceServerUpdated.Register(value);
remove => this._voiceServerUpdated.Unregister(value);
}
private AsyncEvent _voiceServerUpdated;
#endregion
#region Application
///
/// Fired when a new application command is registered.
///
public event AsyncEventHandler ApplicationCommandCreated
{
add => this._applicationCommandCreated.Register(value);
remove => this._applicationCommandCreated.Unregister(value);
}
private AsyncEvent _applicationCommandCreated;
///
/// Fired when an application command is updated.
///
public event AsyncEventHandler ApplicationCommandUpdated
{
add => this._applicationCommandUpdated.Register(value);
remove => this._applicationCommandUpdated.Unregister(value);
}
private AsyncEvent _applicationCommandUpdated;
///
/// Fired when an application command is deleted.
///
public event AsyncEventHandler ApplicationCommandDeleted
{
add => this._applicationCommandDeleted.Register(value);
remove => this._applicationCommandDeleted.Unregister(value);
}
private AsyncEvent _applicationCommandDeleted;
///
/// Fired when a new application command is registered.
///
public event AsyncEventHandler GuildApplicationCommandCountUpdated
{
add => this._guildApplicationCommandCountUpdated.Register(value);
remove => this._guildApplicationCommandCountUpdated.Unregister(value);
}
private AsyncEvent _guildApplicationCommandCountUpdated;
///
/// Fired when a user uses a context menu.
///
public event AsyncEventHandler ContextMenuInteractionCreated
{
add => this._contextMenuInteractionCreated.Register(value);
remove => this._contextMenuInteractionCreated.Unregister(value);
}
private AsyncEvent _contextMenuInteractionCreated;
///
/// Fired when application command permissions gets updated.
///
public event AsyncEventHandler ApplicationCommandPermissionsUpdated
{
add => this._applicationCommandPermissionsUpdated.Register(value);
remove => this._applicationCommandPermissionsUpdated.Unregister(value);
}
private AsyncEvent _applicationCommandPermissionsUpdated;
#endregion
#region Misc
///
/// Fired when an interaction is invoked.
///
public event AsyncEventHandler InteractionCreated
{
add => this._interactionCreated.Register(value);
remove => this._interactionCreated.Unregister(value);
}
private AsyncEvent _interactionCreated;
///
/// Fired when a component is invoked.
///
public event AsyncEventHandler ComponentInteractionCreated
{
add => this._componentInteractionCreated.Register(value);
remove => this._componentInteractionCreated.Unregister(value);
}
private AsyncEvent _componentInteractionCreated;
///
/// Fired when a user starts typing in a channel.
///
public event AsyncEventHandler TypingStarted
{
add => this._typingStarted.Register(value);
remove => this._typingStarted.Unregister(value);
}
private AsyncEvent _typingStarted;
///
/// Fired when an unknown event gets received.
///
public event AsyncEventHandler UnknownEvent
{
add => this._unknownEvent.Register(value);
remove => this._unknownEvent.Unregister(value);
}
private AsyncEvent _unknownEvent;
///
/// Fired whenever webhooks update.
///
public event AsyncEventHandler WebhooksUpdated
{
add => this._webhooksUpdated.Register(value);
remove => this._webhooksUpdated.Unregister(value);
}
private AsyncEvent _webhooksUpdated;
///
/// Fired whenever an error occurs within an event handler.
///
public event AsyncEventHandler ClientErrored
{
add => this._clientErrored.Register(value);
remove => this._clientErrored.Unregister(value);
}
private AsyncEvent _clientErrored;
#endregion
#region Error Handling
///
/// Handles event errors.
///
/// The event.
/// The exception.
/// The event handler.
/// The sender.
/// The event args.
internal void EventErrorHandler(AsyncEvent asyncEvent, Exception ex, AsyncEventHandler handler, TSender sender, TArgs eventArgs)
where TArgs : AsyncEventArgs
{
if (ex is AsyncEventTimeoutException)
{
this.Logger.LogWarning(LoggerEvents.EventHandlerException, $"An event handler for {asyncEvent.Name} took too long to execute. Defined as \"{handler.Method.ToString().Replace(handler.Method.ReturnType.ToString(), "").TrimStart()}\" located in \"{handler.Method.DeclaringType}\".");
return;
}
this.Logger.LogError(LoggerEvents.EventHandlerException, ex, "Event handler exception for event {0} thrown from {1} (defined in {2})", asyncEvent.Name, handler.Method, handler.Method.DeclaringType);
this._clientErrored.InvokeAsync(this, new ClientErrorEventArgs(this.ServiceProvider) { EventName = asyncEvent.Name, Exception = ex }).ConfigureAwait(false).GetAwaiter().GetResult();
}
///
/// Fired when a ratelimit was hit.
///
public event AsyncEventHandler RateLimitHit
{
add => this._rateLimitHit.Register(value);
remove => this._rateLimitHit.Unregister(value);
}
+ // ReSharper disable once InconsistentNaming
internal AsyncEvent _rateLimitHit;
///
/// Fired on heartbeat attempt cancellation due to too many failed heartbeats.
///
public event AsyncEventHandler Zombied
{
add => this._zombied.Register(value);
remove => this._zombied.Unregister(value);
}
private AsyncEvent _zombied;
///
/// Fired when a gateway payload is received.
///
public event AsyncEventHandler PayloadReceived
{
add => this._payloadReceived.Register(value);
remove => this._payloadReceived.Unregister(value);
}
private AsyncEvent _payloadReceived;
///
/// Handles event handler exceptions.
///
/// The event.
/// The exception.
/// The event handler.
/// The sender.
/// The event args.
private void Goof(AsyncEvent asyncEvent, Exception ex, AsyncEventHandler handler, TSender sender, TArgs eventArgs)
where TArgs : AsyncEventArgs => this.Logger.LogCritical(LoggerEvents.EventHandlerException, ex, "Exception event handler {0} (defined in {1}) threw an exception", handler.Method, handler.Method.DeclaringType);
#endregion
}
diff --git a/DisCatSharp/DisCatSharp.csproj b/DisCatSharp/DisCatSharp.csproj
index 922164b0e..291903ad5 100644
--- a/DisCatSharp/DisCatSharp.csproj
+++ b/DisCatSharp/DisCatSharp.csproj
@@ -1,59 +1,59 @@
DisCatSharp
DisCatSharp
DisCatSharp
Another C# API/Framework for Discord Bots.
discord, discord-api, bots, discord-bots, chat, dcs, discatsharp, csharp, dotnet, vb-net, fsharp, webhooks
-
-
+
+
True
True
Resources.resx
ResXFileCodeGenerator
Resources.Designer.cs
diff --git a/DisCatSharp/global.json b/DisCatSharp/global.json
index 4e0e89bbd..d6efff755 100644
--- a/DisCatSharp/global.json
+++ b/DisCatSharp/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "6.0.400",
+ "version": "7.0",
"rollForward": "latestMinor"
}
}
diff --git a/Library.targets b/Library.targets
index 2260fd6ac..b5377d8bb 100644
--- a/Library.targets
+++ b/Library.targets
@@ -1,7 +1,7 @@
Library
- net6.0
+ net7.0
diff --git a/global.json b/global.json
index 4e0e89bbd..3d9090158 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,7 @@
{
- "sdk": {
- "version": "6.0.400",
- "rollForward": "latestMinor"
- }
-}
+ "sdk": {
+ "version": "7.0.0",
+ "rollForward": "latestMinor",
+ "allowPrerelease": true
+ }
+}
\ No newline at end of file