Splitting up, doesn't work

This commit is contained in:
2025-11-23 16:55:44 +01:00
parent d2da0069ec
commit 56fae83f03
11 changed files with 225 additions and 197 deletions

View File

@@ -0,0 +1,32 @@
namespace FluxPose.DiscordBot.Experimenting;
public class Actions<TContext>(Users.Actions<TContext> usersActions, GatewayClient client, TContext context) : ActionsBase<TContext>(context) where TContext : IInteractionContext
{
public async Task<GuildUser?> GetRandomUserFromGuild()
{
var users = await usersActions.GetAllUsersFromGuild();
var index = new Random().Next(users.Count);
return users[index];
}
public async Task RemoveRoleFromAllUsers(ulong roleId)
{
var users = await usersActions.GetAllUsersFromGuild();
foreach (var user in users)
{
if (user.RoleIds.Contains(roleId))
{
continue;
}
await client.Rest.RemoveGuildUserRoleAsync(GuildId, user.Id, roleId);
}
}
public async Task<IReadOnlyList<GuildEmoji>> GetAllGuildEmoji()
{
return await client.Rest.GetGuildEmojisAsync(GuildId);
}
}