Skip to content

Commit 0c244e5

Browse files
committed
fixes
1 parent 80a74ca commit 0c244e5

6 files changed

Lines changed: 60 additions & 2 deletions

File tree

.github/workflows/pypeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
AI_ENDPOINT: ${{ secrets.AI_ENDPOINT }}
4141
AI_TOKEN: ${{ secrets.AI_TOKEN }}
4242
API_KEY_WEATHER: ${{ secrets.API_KEY_WEATHER }}
43+
BOT_VERSION: ${{ github.run_number }}
4344
run: docker compose up -d
4445
- uses: sarisia/actions-status-discord@v1
4546
if: always()

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ services:
88
AI_ENDPOINT: ${AI_ENDPOINT}
99
AI_TOKEN: ${AI_TOKEN}
1010
API_KEY_WEATHER: ${API_KEY_WEATHER}
11+
BOT_VERSION: ${BOT_VERSION}
1112
volumes:
1213
- ./JsonData:/app/JsonData

src/InteractionHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Task LogAsync(LogMessage log)
5151

5252
async Task ReadyAsync()
5353
{
54+
await _client.SetGameAsync($"v{Program.VERSION} | chrisjogos.com", type: ActivityType.CustomStatus);
55+
5456
// Register the commands globally.
5557
// alternatively you can use _handler.RegisterCommandsGloballyAsync() to register commands to a specific guild.
5658
await _handler.RegisterCommandsGloballyAsync();

src/Modules/GuildSettingsModule.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,37 @@ public async Task SetLeaveChannel(SocketTextChannel? textChannel = null) {
5656

5757
#region <<---------- Dynamic Voice ---------->>
5858

59+
60+
[SlashCommand("getvoicehub", "Get the current dynamic voice hub channel.")]
61+
[RequireUserPermission(GuildPermission.Administrator)]
62+
public async Task GetVoiceHub()
63+
{
64+
var path = $"{GuildSettingsService.PATH_PREFIX}{Context.Guild.Id}";
65+
var guildSettings = JsonCache.LoadFromJson<GuildSettings>(path) ?? new GuildSettings();
66+
67+
var embed = new EmbedBuilder();
68+
if (guildSettings.DynamicVoiceSourceId.HasValue)
69+
{
70+
var channel = Context.Guild.GetVoiceChannel(guildSettings.DynamicVoiceSourceId.Value);
71+
if (channel != null)
72+
{
73+
embed.Description = $"Current Voice Hub: {channel.Mention} (ID: {channel.Id})";
74+
embed.Color = Color.Green;
75+
}
76+
else
77+
{
78+
embed.Description = $"Voice Hub ID is set to {guildSettings.DynamicVoiceSourceId.Value}, but the channel was not found.";
79+
embed.Color = Color.Red;
80+
}
81+
}
82+
else
83+
{
84+
embed.Description = "No Dynamic Voice Hub configured.";
85+
embed.Color = Color.Orange;
86+
}
87+
await RespondAsync(embed: embed.Build(), ephemeral: true);
88+
}
89+
5990
[SlashCommand("setvoicehub", "Set the voice channel that triggers dynamic channel creation.")]
6091
[RequireUserPermission(GuildPermission.Administrator)]
6192
public async Task SetVoiceHub(SocketVoiceChannel? voiceChannel = null) {

src/Program.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,26 @@ namespace App;
1616

1717
internal static class Program {
1818

19-
public static readonly Version VERSION = Assembly.GetExecutingAssembly().GetName().Version ?? new ("7.0.0");
19+
public static readonly Version VERSION;
20+
21+
static Program()
22+
{
23+
var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version ?? new Version("7.0.0");
24+
var envVersion = Environment.GetEnvironmentVariable("BOT_VERSION");
25+
26+
if (int.TryParse(envVersion, out var buildNumber))
27+
{
28+
VERSION = new Version(assemblyVersion.Major, assemblyVersion.Minor, buildNumber);
29+
}
30+
else if (Version.TryParse(envVersion, out var parsedVersion))
31+
{
32+
VERSION = parsedVersion;
33+
}
34+
else
35+
{
36+
VERSION = assemblyVersion;
37+
}
38+
}
2039

2140
static IConfigurationRoot Configuration = null!;
2241

src/Services/DynamicVoiceChannelService.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ async Task EnsureOneEmptyChannel(SocketGuild guild)
9292
var hubChannel = guild.GetVoiceChannel(hubId);
9393

9494
// If Hub is deleted/missing, we stop logic for this guild (safety)
95-
if (hubChannel == null) return;
95+
if (hubChannel == null)
96+
{
97+
Console.WriteLine($"[DynamicVoice] Hub channel '{hubId}' not found in guild '{guild.Name}' ({guild.Id}). Configuration might be stale or cache incomplete.");
98+
return;
99+
}
96100

97101
var relevantChannels = new List<SocketVoiceChannel>();
98102
relevantChannels.Add(hubChannel);

0 commit comments

Comments
 (0)