private void handleCommandIndication(CommandMessage context) { if (!context.getGuild().getSelfMember().hasPermission(context.getChannel(), Permission.MESSAGE_MANAGE)) { context.getChannel().sendTyping().queue(); return; } context.getMessage().delete().queue(null, error -> { context.getChannel().sendTyping().queue(); }); }
return Templates.config.cant_find_user.formatGuild(channel, args[0]); txt.sendTyping().queue(); //since it might take a while try { Random rng = new Random();
channel.sendTyping().complete(); CassandraController.runTask(session -> { ResultSet set = session.execute("SELECT playlist_name, scope FROM flarebot.playlist WHERE " +
@Override public boolean onCommand(CommandMessage context, String[] args, GuildTransformer guild, PlaylistTransformer playlist) { String query = String.join(" ", Arrays.copyOfRange(args, 2, args.length)); if (query.trim().length() == 0) { context.makeWarning(context.i18n("invalidFormat")) .set("command", command.generateCommandTrigger(context.getMessage()) + " " + playlist.getName() + " add <song title / link>") .set("type", "song") .queue(); return false; } if (playlist.getSongs().size() >= guild.getType().getLimits().getPlaylist().getSongs()) { context.makeWarning(context.i18n("noMoreSongSlots")) .set("playlist", playlist.getName()) .queue(); return false; } try { new URL(query); } catch (MalformedURLException ex) { query = "ytsearch:" + query; } String finalQuery = query; context.getChannel().sendTyping().queue(v -> loadSong(context, finalQuery, guild, playlist)); return true; }
@Override public void onCommand(User sender, GuildWrapper guild, TextChannel channel, Message message, String[] args, Member member) { if (args.length == 0) { MessageUtils.sendUsage(this, channel, sender, args); return; } channel.sendTyping().complete(); String name = MessageUtils.getMessage(args, 0); CassandraController.runTask(session -> { ResultSet set = session.execute(session .prepare("SELECT playlist_name FROM flarebot.playlist WHERE playlist_name = ? AND guild_id = ?") .bind().setString(0, name).setString(1, channel.getGuild().getId())); if (set.one() != null) { session.execute(session .prepare("DELETE FROM flarebot.playlist WHERE playlist_name = ? AND guild_id = ?").bind() .setString(0, name).setString(1, channel.getGuild().getId())); channel.sendMessage(MessageUtils.getEmbed(sender) .setDescription(String .format("Removed the playlist '%s'", name)).setColor(Color.green) .build()).queue(); } else { MessageUtils.sendErrorMessage(String.format("The playlist '%s' does not exist!", name), channel, sender); } }); }
FlareBot.instance().getMusicManager().getPlayer(guild.getGuildId()).getPlayingTrack(); channel.sendTyping().complete();
public void handleMessage(Guild guild, TextChannel channel, User author, Message message) { if (author == null || (author.isBot() && !security.isInteractionBot(author.getIdLong()))) { return; } if (security.isBanned(author)) { return; } GuildSettings settings = GuildSettings.get(guild.getIdLong()); if (gameHandler.isGameInput(channel, author, message.getContentRaw().toLowerCase())) { gameHandler.execute(author, channel, message.getContentRaw(), null); return; } if (CommandHandler.isCommand(channel, message.getContentRaw().trim(), mentionMe, mentionMeAlias)) { CommandHandler.process(this, channel, author, message); return; } if (GuildSettings.getBoolFor(channel, GSetting.AUTO_REPLY)) { if (autoReplyhandler.autoReplied(message)) { return; } } if (BotConfig.BOT_CHATTING_ENABLED && settings.getBoolValue(GSetting.CHAT_BOT_ENABLED) && channel.getId().equals(GuildSettings.get(channel.getGuild()).getOrDefault(GSetting.BOT_CHANNEL))) { if (PermissionUtil.checkPermission(channel, channel.getGuild().getSelfMember(), Permission.MESSAGE_WRITE)) { channel.sendTyping().queue(); this.out.sendAsyncMessage(channel, this.chatBotHandler.chat(guild.getIdLong(), message.getContentRaw(), channel), null); } } }