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:
parent
e2bf083189
commit
146e1b7b87
2 changed files with 17 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Data;
|
||||||
using Boyfriend.Data;
|
using Boyfriend.Data;
|
||||||
using Boyfriend.Services;
|
using Boyfriend.Services;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Text;
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using Boyfriend.Data;
|
using Boyfriend.Data;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
@ -159,6 +160,19 @@ public class GuildUpdateService : BackgroundService {
|
||||||
|
|
||||||
memberData.Reminders.Remove(reminder);
|
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);
|
var eventsResult = await _eventApi.ListScheduledEventsForGuildAsync(guildId, ct: ct);
|
||||||
|
@ -203,6 +217,8 @@ public class GuildUpdateService : BackgroundService {
|
||||||
storedEvent.Status = scheduledEvent.Status;
|
storedEvent.Status = scheduledEvent.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var result = scheduledEvent.Status switch {
|
var result = scheduledEvent.Status switch {
|
||||||
GuildScheduledEventStatus.Scheduled =>
|
GuildScheduledEventStatus.Scheduled =>
|
||||||
await SendScheduledEventCreatedMessage(scheduledEvent, data.Settings, ct),
|
await SendScheduledEventCreatedMessage(scheduledEvent, data.Settings, ct),
|
||||||
|
|
Loading…
Add table
Reference in a new issue