mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-20 00:43:36 +03:00
nuh-uh
Signed-off-by: mctaylors <95250141+mctaylors@users.noreply.github.com>
This commit is contained in:
parent
fd0c84d834
commit
8261a502f5
1 changed files with 5 additions and 2 deletions
|
@ -20,7 +20,7 @@ namespace Boyfriend.Services;
|
|||
/// <summary>
|
||||
/// Handles executing guild updates (also called "ticks") once per second.
|
||||
/// </summary>
|
||||
public class GuildUpdateService : BackgroundService {
|
||||
public partial class GuildUpdateService : BackgroundService {
|
||||
private static readonly (string Name, TimeSpan Duration)[] SongList = {
|
||||
("UNDEAD CORPORATION - The Empress", new TimeSpan(0, 4, 34)),
|
||||
("UNDEAD CORPORATION - Everything will freeze", new TimeSpan(0, 3, 17)),
|
||||
|
@ -125,7 +125,7 @@ public class GuildUpdateService : BackgroundService {
|
|||
|
||||
var guildUser = await _guildApi.GetGuildMemberAsync(guildId, user.ID, ct);
|
||||
|
||||
var pattern = new Regex(@"^[~`!?@#№$%^&*:;.,()<>{}\[\]\-_=+/\\|']*(.*)");
|
||||
var pattern = IllegalCharsRegex();
|
||||
var match = pattern.Match(guildUser.Entity.Nickname.ToString());
|
||||
await _guildApi.ModifyGuildMemberAsync(guildId, user.ID, match.Groups[1].ToString(), ct: ct);
|
||||
await TickMemberAsync(guildId, user, memberData, defaultRole, ct);
|
||||
|
@ -138,6 +138,9 @@ public class GuildUpdateService : BackgroundService {
|
|||
await TickScheduledEventsAsync(guildId, data, eventsResult.Entity, ct);
|
||||
}
|
||||
|
||||
[GeneratedRegex("^[~`!?@#№$%^&*:;.,()<>{}\\[\\]\\-_=+/\\\\|']*(.*)")]
|
||||
private static partial Regex IllegalCharsRegex();
|
||||
|
||||
private async Task TickScheduledEventsAsync(
|
||||
Snowflake guildId, GuildData data, IEnumerable<IGuildScheduledEvent> events, CancellationToken ct) {
|
||||
foreach (var scheduledEvent in events) {
|
||||
|
|
Loading…
Add table
Reference in a new issue