Fix wrong languages being used in some places

This commit is contained in:
Octol1ttle 2022-11-20 20:45:07 +05:00
parent e3cdcbcf0c
commit c02f503557
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
2 changed files with 7 additions and 0 deletions

View file

@ -110,6 +110,7 @@ public static class EventHandler {
var guild = scheduledEvent.Guild;
var eventConfig = Boyfriend.GetGuildConfig(guild.Id);
var channel = Utils.GetEventNotificationChannel(guild);
Utils.SetCurrentLanguage(guild.Id);
if (channel is not null) {
var role = guild.GetRole(ulong.Parse(eventConfig["EventNotificationRole"]));
@ -137,6 +138,7 @@ public static class EventHandler {
var guild = scheduledEvent.Guild;
var eventConfig = Boyfriend.GetGuildConfig(guild.Id);
var channel = Utils.GetEventNotificationChannel(guild);
Utils.SetCurrentLanguage(guild.Id);
if (channel is not null)
await channel.SendMessageAsync(string.Format(Messages.EventCancelled, Utils.Wrap(scheduledEvent.Name),
eventConfig["FrowningFace"] is "true" ? $" {Messages.SettingsFrowningFace}" : ""));
@ -146,6 +148,7 @@ public static class EventHandler {
var guild = scheduledEvent.Guild;
var eventConfig = Boyfriend.GetGuildConfig(guild.Id);
var channel = Utils.GetEventNotificationChannel(guild);
Utils.SetCurrentLanguage(guild.Id);
if (channel is not null) {
var receivers = eventConfig["EventStartedReceivers"];
@ -167,6 +170,7 @@ public static class EventHandler {
private static async Task ScheduledEventCompletedEvent(SocketGuildEvent scheduledEvent) {
var guild = scheduledEvent.Guild;
var channel = Utils.GetEventNotificationChannel(guild);
Utils.SetCurrentLanguage(guild.Id);
if (channel is not null)
await channel.SendMessageAsync(string.Format(Messages.EventCompleted, Utils.Wrap(scheduledEvent.Name),
Utils.GetHumanizedTimeOffset(DateTimeOffset.Now.Subtract(scheduledEvent.StartTime))));

View file

@ -148,12 +148,14 @@ public static class Utils {
public static async Task DelayedUnbanAsync(CommandProcessor cmd, ulong banned, string reason, TimeSpan duration) {
await Task.Delay(duration);
SetCurrentLanguage(cmd.Context.Guild.Id);
await UnbanCommand.UnbanUserAsync(cmd, banned, reason);
}
public static async Task DelayedUnmuteAsync(CommandProcessor cmd, SocketGuildUser muted, string reason,
TimeSpan duration) {
await Task.Delay(duration);
SetCurrentLanguage(cmd.Context.Guild.Id);
await UnmuteCommand.UnmuteMemberAsync(cmd, muted, reason);
}
@ -165,6 +167,7 @@ public static class Utils {
var guild = scheduledEvent.Guild;
if (guild.GetEvent(scheduledEvent.Id) is null) return;
var eventConfig = Boyfriend.GetGuildConfig(guild.Id);
SetCurrentLanguage(guild.Id);
var receivers = eventConfig["EventStartedReceivers"];
var role = guild.GetRole(ulong.Parse(eventConfig["EventNotificationRole"]));