rename classes

This commit is contained in:
Evan Husted 2025-01-02 21:16:55 -06:00
parent 6905f9a75d
commit bced1eafa0
11 changed files with 36 additions and 70 deletions

View file

@ -1,52 +1,18 @@
<table> <table>
<tr> <tr>
<td align="center" width="25%"> <td align="center" width="25%">
<img src="https://raw.githubusercontent.com/GreemDev/VolteAssets/main/volte_whiteorangepurple.png"></img> <img src="https://raw.githubusercontent.com/Ryubing/Assets/refs/heads/main/RyujinxApp_Rounded.png"/>
</td> </td>
<td align="center" width="75%"> <td align="center" width="75%">
# Volte # RyujinxHelper
A free, robust, open-source Discord bot written in C# with [Discord.Net](https://github.com/discord-net/Discord.Net). A simple bot based on Volte.
[![Discord](https://img.shields.io/discord/405806471578648588.svg?color=7000FB&label=discord&style=for-the-badge)](https://discord.gg/H8bcFr2) [![License](https://img.shields.io/github/license/Ryubing/RyujinxHelper.svg?color=7000FB&style=for-the-badge)](https://github.com/Ryubing/RyujinxHelper/blob/v4/LICENSE)
[![License](https://img.shields.io/github/license/Polyhaze/Volte.svg?color=7000FB&style=for-the-badge)](https://github.com/Polyhaze/Volte/blob/v4/LICENSE)
</td>
</tr>
</table>
|**Prefix**: $|**Lead:** [@GreemDev](https://github.com/GreemDev)|**Lang:** C#|**Library:** [Discord.Net](https://github.com/discord-net/Discord.Net)|[Discord Guild](https://discord.gg/H8bcFr2)|
|---|---|---|---|---|
## Quick Links
- [Feature List](https://github.com/Polyhaze/Volte/wiki/Features)
- [Issue Tracker](https://github.com/Polyhaze/Volte/issues)
## Bots made by Cool People
* [jacksonrakena/jacksonbot](https://github.com/abyssal/Abyss)
* [QuantumToast/Administrator](https://gitlab.com/QuantumToast/Administrator)
## Like Volte? Here's a few things you can do if you want.
* Star this repo.
* Throw a few dollars at me on [PayPal](https://paypal.me/greemdev).
* Join my Discord and be a functioning member of society.
Don't want to do any of these? Using the bot and liking it is enough for me :)
## Thanks To
<table>
<tr>
<td align="center" width="50%">
<a href="https://www.jetbrains.com/"><img src="https://raw.githubusercontent.com/GreemDev/VolteAssets/main/jetbrains_logo.png" alt="Jetbrains" width="150px"></img></a>
<p><strong>For providing me with an open-source license for developement of Volte using Rider.</strong></p>
</td>
<td align="center" width="50%">
<a href="https://github.com/jacksonrakena"><img src="https://avatars.githubusercontent.com/u/44521335" alt="abyssal" width="150px"></img></a>
<p><strong>For letting me <strike>steal your code</strike> use <a href="https://github.com/jacksonrakena/jacksonbot">whatever the hell your bot's name is now</a> as a reference.</strong></p>
</td> </td>
</tr> </tr>
</table> </table>
| **Prefix**: $ | **Lead:** [@GreemDev](https://github.com/GreemDev) | **Lang:** C# | **Library:** [Discord.Net](https://github.com/discord-net/Discord.Net) | [Discord Guild](https://discord.gg/ryujinx) |
|---------------|----------------------------------------------------|--------------|------------------------------------------------------------------------|---------------------------------------------|

View file

@ -5,7 +5,7 @@ using RyuBot.Services;
namespace RyuBot; namespace RyuBot;
public class VolteBot public class RyujinxBot
{ {
public static Task StartAsync(Gommon.Optional<CancellationTokenSource> cts = default) public static Task StartAsync(Gommon.Optional<CancellationTokenSource> cts = default)
{ {
@ -21,7 +21,7 @@ public class VolteBot
public static DiscordSocketClient Client { get; private set; } public static DiscordSocketClient Client { get; private set; }
public static CancellationTokenSource Cts { get; private set; } public static CancellationTokenSource Cts { get; private set; }
public VolteBot() public RyujinxBot()
=> Console.CancelKeyPress += (_, _) => Cts?.Cancel(); => Console.CancelKeyPress += (_, _) => Cts?.Cancel();
public static async Task LoginAsync(Gommon.Optional<CancellationTokenSource> cts = default) public static async Task LoginAsync(Gommon.Optional<CancellationTokenSource> cts = default)

View file

@ -34,7 +34,7 @@ public static partial class Logger
internal static void PrintHeader() internal static void PrintHeader()
{ {
if (!VolteBot.IsHeadless) return; if (!RyujinxBot.IsHeadless) return;
Info(LogSource.Volte, CommandEventArgs.Separator.Trim()); Info(LogSource.Volte, CommandEventArgs.Separator.Trim());
VolteAscii.ForEach(static ln => Info(LogSource.Volte, ln)); VolteAscii.ForEach(static ln => Info(LogSource.Volte, ln));

View file

@ -10,10 +10,10 @@ public class VolteInteractionModule<T> : InteractionModuleBase<SocketInteraction
public bool IsInGuild() => Context.Guild != null; public bool IsInGuild() => Context.Guild != null;
public GuildData GetData() public GuildData GetData()
=> VolteBot.Services.Get<DatabaseService>().GetData(Context.Guild); => RyujinxBot.Services.Get<DatabaseService>().GetData(Context.Guild);
public void ModifyData(DataEditor modifier) public void ModifyData(DataEditor modifier)
=> VolteBot.Services.Get<DatabaseService>().Modify(Context.Guild.Id, modifier); => RyujinxBot.Services.Get<DatabaseService>().Modify(Context.Guild.Id, modifier);
protected InteractionBadRequestResult BadRequest(string reason) => new(reason); protected InteractionBadRequestResult BadRequest(string reason) => new(reason);

View file

@ -22,6 +22,6 @@ public static class Program
public static async Task StartBotAsync(Dictionary<string, string> args = null) public static async Task StartBotAsync(Dictionary<string, string> args = null)
{ {
CommandLineArguments = new (args ?? new Dictionary<string, string>()); CommandLineArguments = new (args ?? new Dictionary<string, string>());
await VolteBot.StartAsync(); await RyujinxBot.StartAsync();
} }
} }

View file

@ -58,7 +58,7 @@ public partial class LogsViewModel : ObservableObject
if (eventArgs.Error is not { } err) return; if (eventArgs.Error is not { } err) return;
VolteApp.NotifyError(err); RyujinxBotApp.NotifyError(err);
err.SentryCapture(scope => err.SentryCapture(scope =>
scope.AddBreadcrumb( scope.AddBreadcrumb(
"This exception might not have been thrown, and may not be important; it is merely being logged.") "This exception might not have been thrown, and may not be important; it is merely being logged.")

View file

@ -12,25 +12,25 @@ public partial class UIShellViewModel : ObservableObject
public UIShellViewModel() public UIShellViewModel()
{ {
VolteBot.Client.Connected += ChangeConnectionState; RyujinxBot.Client.Connected += ChangeConnectionState;
VolteBot.Client.Disconnected += Disconnected; RyujinxBot.Client.Disconnected += Disconnected;
} }
~UIShellViewModel() ~UIShellViewModel()
{ {
VolteBot.Client.Connected -= ChangeConnectionState; RyujinxBot.Client.Connected -= ChangeConnectionState;
VolteBot.Client.Disconnected -= Disconnected; RyujinxBot.Client.Disconnected -= Disconnected;
} }
private Task ChangeConnectionState() private Task ChangeConnectionState()
{ {
Connection = VolteManager.GetConnectionState(); Connection = BotManager.GetConnectionState();
return Task.CompletedTask; return Task.CompletedTask;
} }
private Task Disconnected(Exception e) private Task Disconnected(Exception e)
{ {
VolteApp.NotifyError(e); RyujinxBotApp.NotifyError(e);
return ChangeConnectionState(); return ChangeConnectionState();
} }
} }

View file

@ -1,7 +1,7 @@
<Application xmlns="https://github.com/avaloniaui" <Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sty="using:FluentAvalonia.Styling" xmlns:sty="using:FluentAvalonia.Styling"
x:Class="RyuBot.UI.Avalonia.VolteApp"> x:Class="RyuBot.UI.Avalonia.RyujinxBotApp">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View file

@ -16,7 +16,7 @@ using RyuBot.UI.Helpers;
namespace RyuBot.UI.Avalonia; namespace RyuBot.UI.Avalonia;
public class VolteApp : Application public class RyujinxBotApp : Application
{ {
private static WindowNotificationManager? _notificationManager; private static WindowNotificationManager? _notificationManager;
@ -61,7 +61,7 @@ public class VolteApp : Application
desktop.MainWindow.Closing += (_, _) => desktop.MainWindow.Closing += (_, _) =>
{ {
LogsViewModel.UnregisterHandler(); LogsViewModel.UnregisterHandler();
VolteManager.Stop(); BotManager.Stop();
}; };
TaskScheduler.UnobservedTaskException += (_, eventArgs) => TaskScheduler.UnobservedTaskException += (_, eventArgs) =>
@ -83,7 +83,7 @@ public class VolteApp : Application
#endif #endif
} }
VolteManager.Start(); BotManager.Start();
} }
public static void Notify(Notification notification) public static void Notify(Notification notification)

View file

@ -2,9 +2,9 @@
namespace RyuBot.UI; namespace RyuBot.UI;
public class VolteManager public class BotManager
{ {
static VolteManager() static BotManager()
{ {
Console.Title = $"RyuBot {Version.InformationVersion}"; Console.Title = $"RyuBot {Version.InformationVersion}";
Console.CursorVisible = false; Console.CursorVisible = false;
@ -16,16 +16,16 @@ public class VolteManager
public static void Start() public static void Start()
{ {
if (VolteBot.Client is not null && Cts is not null) return; if (RyujinxBot.Client is not null && Cts is not null) return;
Cts = new(); Cts = new();
_botTask = Task.Run(async () => await VolteBot.LoginAsync(Cts), Cts.Token); _botTask = Task.Run(async () => await RyujinxBot.LoginAsync(Cts), Cts.Token);
} }
public static async Task<int> StartWait() public static async Task<int> StartWait()
{ {
if (VolteBot.IsHeadless) if (RyujinxBot.IsHeadless)
Logger.OutputLogToStandardOut(); Logger.OutputLogToStandardOut();
Start(); Start();
@ -35,7 +35,7 @@ public class VolteManager
public static void Stop() public static void Stop()
{ {
if (VolteBot.Client is null && Cts is null) return; if (RyujinxBot.Client is null && Cts is null) return;
Cts!.Cancel(); Cts!.Cancel();
_botTask = null; _botTask = null;
@ -44,7 +44,7 @@ public class VolteManager
} }
public static string GetConnectionState() public static string GetConnectionState()
=> VolteBot.Client is null => RyujinxBot.Client is null
? "Disconnected" ? "Disconnected"
: Enum.GetName(VolteBot.Client.ConnectionState) ?? "Disconnected"; : Enum.GetName(RyujinxBot.Client.ConnectionState) ?? "Disconnected";
} }

View file

@ -18,12 +18,12 @@ public class Program
if (!UnixHelper.TryParseNamedArguments(args, out var output) && output.Error is not InvalidOperationException) if (!UnixHelper.TryParseNamedArguments(args, out var output) && output.Error is not InvalidOperationException)
Logger.Error(output.Error); Logger.Error(output.Error);
VolteBot.IsHeadless = args.Contains("--no-gui"); RyujinxBot.IsHeadless = args.Contains("--no-gui");
if (VolteBot.IsHeadless) if (RyujinxBot.IsHeadless)
return await VolteManager.StartWait(); return await BotManager.StartWait();
VolteManager.Start(); BotManager.Start();
IconProvider.Current.Register<FontAwesomeIconProvider>(); IconProvider.Current.Register<FontAwesomeIconProvider>();
@ -33,7 +33,7 @@ public class Program
// Avalonia configuration, don't remove; also used by visual designer. // Avalonia configuration, don't remove; also used by visual designer.
private static AppBuilder BuildAvaloniaApp() private static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<VolteApp>() => AppBuilder.Configure<RyujinxBotApp>()
.UsePlatformDetect() .UsePlatformDetect()
.WithInterFont(); .WithInterFont();
} }