Search in sources :

Example 1 with UserCountDown

use of com.github.vaerys.objects.UserCountDown in project DiscordSailv2 by Vaerys-Dawn.

the class JoinHandler method autoReMute.

/**
 * Automatically re-mutes users that were muted when they left and their mute timer hasnt timed out.
 *
 * @param user    The user that joined. ({@link UserObject})
 * @param content The Guild that the user joined. ({@link GuildObject})
 * @param event   The event that calls this. ({@link UserJoinEvent})
 */
public static void autoReMute(UserJoinEvent event, GuildObject content, UserObject user) {
    for (UserCountDown u : content.users.mutedUsers) {
        if (u.getID() == event.getUser().getLongID()) {
            IChannel admin = content.getChannelByType(ChannelSetting.ADMIN);
            if (admin != null) {
                RequestHandler.sendMessage("> Looks like " + user.mention() + " has returned, I have muted them again for you.", admin);
            }
            RequestHandler.roleManagement(user, content, content.config.getMutedRoleID(), true);
        }
    }
}
Also used : IChannel(sx.blah.discord.handle.obj.IChannel) UserCountDown(com.github.vaerys.objects.UserCountDown)

Example 2 with UserCountDown

use of com.github.vaerys.objects.UserCountDown in project DiscordSailv2 by Vaerys-Dawn.

the class GuildUsers method muteUser.

public boolean muteUser(long userID, long time, long guildID) {
    boolean found = false;
    for (UserCountDown c : mutedUsers) {
        if (c.getID() == userID) {
            c.setRemainderSecs(time);
            found = true;
        }
    }
    if (!found) {
        mutedUsers.add(new UserCountDown(userID, time));
    }
    return RequestHandler.muteUser(guildID, userID, true);
}
Also used : UserCountDown(com.github.vaerys.objects.UserCountDown)

Aggregations

UserCountDown (com.github.vaerys.objects.UserCountDown)2 IChannel (sx.blah.discord.handle.obj.IChannel)1