use of net.dv8tion.jda.core.entities.TextChannel in project Gary by help-chat.
the class WordChanger method run.
public void run() {
TextChannel channel = jda.getTextChannelById(Constants.CR);
String word = crr.getRandomWord();
String scrambled = crr.scrambleWord(word);
MessageEmbed message = new EmbedBuilder().setTitle("Word Update").setDescription(mutil.bigLetters(scrambled)).setFooter("Gary v" + version.getVersion(), "https://cdn.discordapp.com/avatars/332142935380459520/2d2b0a78ec3ab461f23721a51a292a3e.png").build();
channel.getManager().setTopic("Scramble >> " + mutil.bigLetters(scrambled)).queue();
channel.sendMessage(message).complete().delete().queueAfter(5, TimeUnit.MINUTES);
files.setWord(word);
}
use of net.dv8tion.jda.core.entities.TextChannel in project pokeraidbot by magnusmickelsson.
the class StartUpEventListener method attachToGroupMessage.
private boolean attachToGroupMessage(Guild guild, Config config, RaidGroup raidGroup) {
MessageChannel channel = null;
try {
final List<TextChannel> textChannels = guild.getTextChannels();
for (TextChannel textChannel : textChannels) {
if (textChannel.getName().equalsIgnoreCase(raidGroup.getChannel())) {
channel = textChannel;
break;
}
}
final Locale locale = config.getLocale();
Raid raid = raidRepository.getById(raidGroup.getRaidId());
final EmoticonSignUpMessageListener emoticonSignUpMessageListener = new EmoticonSignUpMessageListener(botService, localeService, serverConfigRepository, raidRepository, pokemonRepository, gymRepository, raid.getId(), raidGroup.getStartsAt(), raidGroup.getCreatorId());
emoticonSignUpMessageListener.setEmoteMessageId(raidGroup.getEmoteMessageId());
emoticonSignUpMessageListener.setInfoMessageId(raidGroup.getInfoMessageId());
final int delayTime = raid.isExRaid() ? 1 : 15;
final TimeUnit delayTimeUnit = raid.isExRaid() ? TimeUnit.MINUTES : TimeUnit.SECONDS;
final Callable<Boolean> groupEditTask = NewRaidGroupCommand.getMessageRefreshingTaskToSchedule(channel, raid, emoticonSignUpMessageListener, raidGroup.getInfoMessageId(), locale, raidRepository, localeService, clockService, executorService, botService, delayTimeUnit, delayTime, raidGroup.getId());
executorService.submit(groupEditTask);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Found group message for raid " + raid + " in channel " + (channel == null ? "N/A" : channel.getName()) + " (server " + guild.getName() + "). Attaching to it.");
}
return true;
} catch (UserMessedUpException e) {
if (channel != null)
channel.sendMessage(e.getMessage()).queue(m -> {
m.delete().queueAfter(BotServerMain.timeToRemoveFeedbackInSeconds, TimeUnit.SECONDS);
});
} catch (ErrorResponseException e) {
// We couldn't find the message in this channel or had permission issues, ignore
LOGGER.info("Caught exception during startup: " + e.getMessage());
LOGGER.warn("Cleaning up raidgroup...");
cleanUpRaidGroup(raidGroup);
LOGGER.debug("Stacktrace:", e);
} catch (Throwable e) {
LOGGER.warn("Cleaning up raidgroup due to exception: " + e.getMessage());
cleanUpRaidGroup(raidGroup);
}
return false;
}
use of net.dv8tion.jda.core.entities.TextChannel in project Ardent by adamint.
the class TriviaGame method finish.
public void finish(Shard shard, Command command) throws Exception {
totalRounds = 9001;
final int bonus = 250;
final int perQuestion = 50;
Trivia.gamesInSession.remove(this);
Trivia.gamesSettingUp.remove(guildId);
Guild guild = shard.jda.getGuildById(guildId);
TextChannel channel = guild.getTextChannelById(textChannelId);
channel.sendMessage(displayScores(shard, command).build()).queue();
channel.sendMessage("Thanks for playing! You'll receive **$50** for every correct answer").queue();
Map<String, Integer> sorted = MapUtils.sortByValue(scores);
Iterator<Map.Entry<String, Integer>> iterator = sorted.entrySet().iterator();
int current = 0;
while (iterator.hasNext()) {
Map.Entry<String, Integer> entry = iterator.next();
User user = guild.getMemberById(entry.getKey()).getUser();
Profile profile = Profile.get(user);
profile.addMoney(perQuestion * entry.getValue());
if (current == 0 && !isSolo() && scores.size() > 1) {
profile.addMoney(bonus);
channel.sendMessage(user.getAsMention() + ", you won a **$250** bonus for being so smart!").queue();
}
current++;
}
}
use of net.dv8tion.jda.core.entities.TextChannel in project Ardent by adamint.
the class ArdentMusicManager method setChannel.
public void setChannel(MessageChannel channel) {
assert channel != null;
this.channel = channel.getId();
MusicSettingsModel guildMusicSettings = BaseCommand.asPojo(r.db("data").table("music_settings").get(((TextChannel) channel).getGuild().getId()).run(connection), MusicSettingsModel.class);
shouldAnnounce = !(guildMusicSettings == null || !guildMusicSettings.announce_music);
}
use of net.dv8tion.jda.core.entities.TextChannel in project TheLighterBot by PhotonBursted.
the class FileController method retrieveLinkedChannels.
private void retrieveLinkedChannels() throws SQLException {
retrieveData("SELECT *\n" + "FROM \"LinkedChannels\"", result -> {
try {
TextChannel tc = l.getBot().getTextChannelById(result.getLong("tc_id"));
VoiceChannel vc = l.getBot().getVoiceChannelById(result.getLong("vc_id"));
if (tc != null && vc != null) {
l.getChannelController().getLinkedChannels().putStoring(tc, vc);
}
} catch (SQLException ex) {
log.error("Something went wrong retrieving the linked channels", ex);
}
});
}
Aggregations