Splitting up, doesn't work
This commit is contained in:
32
FluxPoseDiscordBot/Experimenting/Actions.cs
Normal file
32
FluxPoseDiscordBot/Experimenting/Actions.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user