use of toby.jpa.dto.UserDto in project toby-bot by ml404.
the class AdjustUserCommand method createNewUser.
private void createNewUser(TextChannel channel, Member targetMember, int deleteDelay) {
// Database did not contain an entry for the user we have made a request against, so make one.
UserDto newDto = new UserDto();
newDto.setDiscordId(targetMember.getIdLong());
newDto.setGuildId(targetMember.getGuild().getIdLong());
userService.createNewUser(newDto);
channel.sendMessageFormat("User %s's permissions did not exist in this server's database, they have now been created", targetMember.getNickname()).queue(message -> ICommand.deleteAfter(message, deleteDelay));
}
use of toby.jpa.dto.UserDto in project toby-bot by ml404.
the class Kf2RandomMapCommand method handle.
@Override
@SuppressWarnings("unchecked")
public void handle(CommandContext ctx, String prefix, UserDto requestingUserDto, Integer deleteDelay) {
ICommand.deleteAfter(ctx.getMessage(), deleteDelay);
final TextChannel channel = ctx.getChannel();
try {
WikiFetcher wikiFetcher = new WikiFetcher(cache);
List<String> kf2Maps = wikiFetcher.fetchFromWiki(cacheName, kf2WebUrl, className, "b");
channel.sendMessage(RandomCommand.getRandomElement(kf2Maps)).queue(message -> ICommand.deleteAfter(message, deleteDelay));
} catch (IOException ignored) {
channel.sendMessage("Huh, the website I pull data from must have returned something unexpected.").queue(message -> ICommand.deleteAfter(message, deleteDelay));
}
}
Aggregations