HelperLib 1.2.0
See the version list below for details.
dotnet add package HelperLib --version 1.2.0
NuGet\Install-Package HelperLib -Version 1.2.0
<PackageReference Include="HelperLib" Version="1.2.0" />
<PackageVersion Include="HelperLib" Version="1.2.0" />
<PackageReference Include="HelperLib" />
paket add HelperLib --version 1.2.0
#r "nuget: HelperLib, 1.2.0"
#:package HelperLib@1.2.0
#addin nuget:?package=HelperLib&version=1.2.0
#tool nuget:?package=HelperLib&version=1.2.0
HelperLib
HelperLib is a small utility library with helpers commonly used when building Discord bots with Discord.NET (targeting .NET 9). It provides convenience wrappers and utilities to simplify common tasks, such as parsing mentions, sending embeds/images, interacting with guild entities, and handling basic reliability for the Discord client.
Features
IonicHelper— Common static helpers for working with a runningDiscordSocketClient(guild/channel/role lookups, guild user enumeration, role checks, cancellation token management, and simple reconnect handling).Services.ReliabilityService— Encapsulates a reconnect/reset strategy forDiscordSocketClientwith configurable timeout behavior.Util.MentionUtils— Create and parse Discord mentions for users, channels, and roles.Util.Extensions— Extension helpers for sendingEmbed/EmbedBuilderand sending images from URLs.Preconditions.RequireRoleAttribute— Command precondition attribute for Discord.Commands that restrict usage to a given role ID.Models.GuildUsersResult— Lightweight result type for guild user enumeration.
Quick start
- Add the project or compiled DLL to your bot solution (project reference or NuGet if you publish it).
- Create and start a
DiscordSocketClientusingIonicHelperor useReliabilityServiceto attach reconnect behavior.
Example (simple start using IonicHelper):
var token = "YOUR_BOT_TOKEN";
var helper = new IonicHelper(token, defaultGuildId: 123456789012345678);
await helper.RunAsync(new DiscordSocketConfig(), message => { Console.WriteLine(message); return Task.CompletedTask; });
Example usages:
- Parse a user mention:
if (MentionUtils.TryParseUser("<@!123456>", out var userId)) { /* use userId */ }
- Send an embed using extension methods:
await textChannel.SendEmbedAsync(new EmbedBuilder().WithTitle("Hello").Build());
- Require a role on a command:
[RequireRole(123456789012345678)]
public async Task MyCommand() { ... }
Notes
- This library is intended as a convenience layer over Discord.NET and expects a
DiscordSocketClientto be available at runtime when usingIonicHelperstatic helpers. - The reconnect logic is intentionally simple: on repeated failures, the process will exit (FailFast/Environment.Exit) so that orchestration systems can restart the bot.
Contributing
PRs and bug reports are welcome. Keep changes focused and add tests or usage examples when possible.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Discord.Net (>= 3.19.1)
- Discord.Net.Commands (>= 3.19.1)
- Discord.Net.WebSocket (>= 3.19.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.3.0 | 492 | 4/12/2026 |
| 1.2.0 | 351 | 3/28/2026 |
| 1.1.3 | 173 | 3/28/2026 |
| 1.1.2 | 363 | 7/7/2024 |
| 1.1.1 | 229 | 5/2/2024 |
| 1.1.0 | 208 | 5/2/2024 |
| 1.0.11 | 276 | 4/15/2024 |
| 1.0.10 | 265 | 4/11/2024 |
| 1.0.9 | 387 | 7/22/2023 |
| 1.0.8 | 249 | 7/22/2023 |
| 1.0.7 | 264 | 7/20/2023 |
| 1.0.6 | 263 | 7/16/2023 |
| 1.0.5 | 555 | 7/29/2022 |
| 1.0.4 | 538 | 7/29/2022 |
| 1.0.3 | 627 | 1/17/2022 |
| 1.0.2 | 564 | 1/17/2022 |
| 1.0.1 | 479 | 12/26/2021 |
| 1.0.0 | 473 | 12/25/2021 |