fix(bot): prefix command_message keys

This commit is contained in:
alyssa 2025-03-29 12:20:11 +00:00
parent 7cd3939f95
commit 64ff69723c

View file

@ -27,7 +27,7 @@ public class CommandMessageService
messageId, authorId, channelId messageId, authorId, channelId
); );
await _redis.Connection.GetDatabase().StringSetAsync(messageId.ToString(), $"{authorId}-{channelId}-{guildId}", expiry: CommandMessageRetention); await _redis.Connection.GetDatabase().StringSetAsync("command_message:" + messageId.ToString(), $"{authorId}-{channelId}-{guildId}", expiry: CommandMessageRetention);
} }
public async Task<CommandMessage?> GetCommandMessage(ulong messageId) public async Task<CommandMessage?> GetCommandMessage(ulong messageId)
@ -38,6 +38,12 @@ public class CommandMessageService
var split = ((string)str).Split("-"); var split = ((string)str).Split("-");
return new CommandMessage(ulong.Parse(split[0]), ulong.Parse(split[1]), ulong.Parse(split[2])); return new CommandMessage(ulong.Parse(split[0]), ulong.Parse(split[1]), ulong.Parse(split[2]));
} }
str = await _redis.Connection.GetDatabase().StringGetAsync("command_message:" + messageId.ToString());
if (str.HasValue)
{
var split = ((string)str).Split("-");
return new CommandMessage(ulong.Parse(split[0]), ulong.Parse(split[1]), ulong.Parse(split[2]));
}
return null; return null;
} }
} }