1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Rename users to "nickname" who attempt to hoist themselves

This commit is contained in:
nrdk 2023-07-20 04:34:47 +05:00
parent e2bf083189
commit 146e1b7b87
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 037977635882C149
2 changed files with 17 additions and 0 deletions

View file

@ -1,3 +1,4 @@
using System.Data;
using Boyfriend.Data;
using Boyfriend.Services;
using JetBrains.Annotations;

View file

@ -1,3 +1,4 @@
using System.Text;
using System.Text.Json.Nodes;
using Boyfriend.Data;
using Microsoft.Extensions.Hosting;
@ -159,6 +160,19 @@ public class GuildUpdateService : BackgroundService {
memberData.Reminders.Remove(reminder);
}
var guildUser = _guildApi.GetGuildMemberAsync(guildId, userId, ct);
var tag = guildUser.Result.Entity.Nickname.ToString();
var symbols = new char[16] { "~"[0], "`"[0], "!"[0], "@"[0], "#"[0], "$"[0], "%"[0], "^"[0], "&"[0], "*"[0], "("[0], ")"[0], "_"[0], "-"[0], "+"[0], "="[0]};
foreach (var symbol in symbols) {
if (tag[0] == symbol) {
var rename = await _guildApi.ModifyGuildMemberAsync(guildId, userId, "nickname" ,ct: ct);
}
}
}
var eventsResult = await _eventApi.ListScheduledEventsForGuildAsync(guildId, ct: ct);
@ -203,6 +217,8 @@ public class GuildUpdateService : BackgroundService {
storedEvent.Status = scheduledEvent.Status;
}
var result = scheduledEvent.Status switch {
GuildScheduledEventStatus.Scheduled =>
await SendScheduledEventCreatedMessage(scheduledEvent, data.Settings, ct),