Update to JDA 4.2.0
This commit is contained in:
@@ -43,4 +43,4 @@ public class CommandChoose extends Command
|
||||
|
||||
res.send(String.format(LocStrings.stub("ChooseChoice"), (choices[(int) (Math.random()*choices.length)]).toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,15 +23,14 @@ import dataStructures.KittyRole;
|
||||
import dataStructures.KittyStartupMode;
|
||||
import dataStructures.KittyUser;
|
||||
import main.Main;
|
||||
import net.dv8tion.jda.core.AccountType;
|
||||
import net.dv8tion.jda.core.JDA;
|
||||
import net.dv8tion.jda.core.JDABuilder;
|
||||
import net.dv8tion.jda.core.entities.Emote;
|
||||
import net.dv8tion.jda.core.entities.Game;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.entities.User;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.AccountType;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.JDABuilder;
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import offline.Ref;
|
||||
import utils.AdminControl;
|
||||
//import utils.AudioUtils;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package dataStructures;
|
||||
|
||||
import net.dv8tion.jda.core.JDA;
|
||||
|
||||
public class KittyCore
|
||||
{
|
||||
public final JDA jda;
|
||||
|
||||
public KittyCore(JDA kitty)
|
||||
{
|
||||
this.jda = kitty;
|
||||
}
|
||||
}
|
||||
package dataStructures;
|
||||
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
|
||||
public class KittyCore
|
||||
{
|
||||
public final JDA jda;
|
||||
|
||||
public KittyCore(JDA kitty)
|
||||
{
|
||||
this.jda = kitty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ package dataStructures;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
import net.dv8tion.jda.core.JDA;
|
||||
import net.dv8tion.jda.core.MessageBuilder;
|
||||
import net.dv8tion.jda.core.entities.TextChannel;
|
||||
import net.dv8tion.jda.core.events.message.guild.*;
|
||||
import net.dv8tion.jda.core.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.MessageBuilder;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import utils.GlobalLog;
|
||||
import utils.LogFilter;
|
||||
|
||||
|
||||
+100
-100
@@ -1,100 +1,100 @@
|
||||
package dataStructures;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import core.ObjectBuilderFactory;
|
||||
import net.dv8tion.jda.core.entities.Member;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class UserInput
|
||||
{
|
||||
// Variables
|
||||
public String key;
|
||||
public String args;
|
||||
public KittyUser [] mentions;
|
||||
private boolean isValid;
|
||||
public String message;
|
||||
|
||||
// NOTE(wisp): Designed to parse a string as it's constructed.
|
||||
// If a user enters the command "!ping some stuff here :D"
|
||||
// and if the command indicator is !, then...
|
||||
//
|
||||
// key=ping
|
||||
// args=some stuff here :D
|
||||
//
|
||||
// The CommandIndicator and spaces between the key and args are dropped.
|
||||
public UserInput(GuildMessageReceivedEvent event, KittyGuild guildContext)
|
||||
{
|
||||
String toParse = event.getMessage().getContentRaw();
|
||||
message = toParse;
|
||||
|
||||
key = "";
|
||||
args = "";
|
||||
|
||||
if(toParse.length() <= 0)
|
||||
return;
|
||||
|
||||
if(!event.getMessage().getMentionedMembers().isEmpty())
|
||||
mentions = findMentionedUsers(event);
|
||||
|
||||
toParse = toParse.trim();
|
||||
String commandIndicator = guildContext.getCommandIndicator();
|
||||
if(toParse.startsWith(commandIndicator))
|
||||
{
|
||||
int loc = findFirstWhitespace(toParse);
|
||||
|
||||
if(loc <= 0)
|
||||
{
|
||||
key = toParse.substring(commandIndicator.length()).trim().toLowerCase();
|
||||
}
|
||||
else
|
||||
{
|
||||
key = toParse.substring(commandIndicator.length(), loc).trim().toLowerCase();
|
||||
args = toParse.substring(loc).trim();
|
||||
}
|
||||
|
||||
isValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Used for injecting direct commands from plugins
|
||||
public UserInput(String input, KittyGuild contextGuild)
|
||||
{
|
||||
int loc = findFirstWhitespace(input);
|
||||
key = input.substring(0, loc);
|
||||
args = input.substring(loc);
|
||||
isValid = true;
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return isValid;
|
||||
}
|
||||
|
||||
// Finds first whitespace in the string
|
||||
private int findFirstWhitespace(String str)
|
||||
{
|
||||
for (int i = 0; i < str.length(); ++i)
|
||||
{
|
||||
if (Character.isWhitespace(str.charAt(i)))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private KittyUser[] findMentionedUsers(GuildMessageReceivedEvent event)
|
||||
{
|
||||
List <Member> JDAMentions = event.getMessage().getMentionedMembers();
|
||||
KittyUser [] KittyMentions = new KittyUser[JDAMentions.size()];
|
||||
for(int i = 0; i < KittyMentions.length; i ++)
|
||||
{
|
||||
KittyMentions [i] = ObjectBuilderFactory.getKittyUser(event.getGuild().getId(), JDAMentions.get(i).getUser().getId());
|
||||
}
|
||||
return KittyMentions;
|
||||
}
|
||||
}
|
||||
package dataStructures;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import core.ObjectBuilderFactory;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
|
||||
public class UserInput
|
||||
{
|
||||
// Variables
|
||||
public String key;
|
||||
public String args;
|
||||
public KittyUser [] mentions;
|
||||
private boolean isValid;
|
||||
public String message;
|
||||
|
||||
// NOTE(wisp): Designed to parse a string as it's constructed.
|
||||
// If a user enters the command "!ping some stuff here :D"
|
||||
// and if the command indicator is !, then...
|
||||
//
|
||||
// key=ping
|
||||
// args=some stuff here :D
|
||||
//
|
||||
// The CommandIndicator and spaces between the key and args are dropped.
|
||||
public UserInput(GuildMessageReceivedEvent event, KittyGuild guildContext)
|
||||
{
|
||||
String toParse = event.getMessage().getContentRaw();
|
||||
message = toParse;
|
||||
|
||||
key = "";
|
||||
args = "";
|
||||
|
||||
if(toParse.length() <= 0)
|
||||
return;
|
||||
|
||||
if(!event.getMessage().getMentionedMembers().isEmpty())
|
||||
mentions = findMentionedUsers(event);
|
||||
|
||||
toParse = toParse.trim();
|
||||
String commandIndicator = guildContext.getCommandIndicator();
|
||||
if(toParse.startsWith(commandIndicator))
|
||||
{
|
||||
int loc = findFirstWhitespace(toParse);
|
||||
|
||||
if(loc <= 0)
|
||||
{
|
||||
key = toParse.substring(commandIndicator.length()).trim().toLowerCase();
|
||||
}
|
||||
else
|
||||
{
|
||||
key = toParse.substring(commandIndicator.length(), loc).trim().toLowerCase();
|
||||
args = toParse.substring(loc).trim();
|
||||
}
|
||||
|
||||
isValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Used for injecting direct commands from plugins
|
||||
public UserInput(String input, KittyGuild contextGuild)
|
||||
{
|
||||
int loc = findFirstWhitespace(input);
|
||||
key = input.substring(0, loc);
|
||||
args = input.substring(loc);
|
||||
isValid = true;
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return isValid;
|
||||
}
|
||||
|
||||
// Finds first whitespace in the string
|
||||
private int findFirstWhitespace(String str)
|
||||
{
|
||||
for (int i = 0; i < str.length(); ++i)
|
||||
{
|
||||
if (Character.isWhitespace(str.charAt(i)))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private KittyUser[] findMentionedUsers(GuildMessageReceivedEvent event)
|
||||
{
|
||||
List <Member> JDAMentions = event.getMessage().getMentionedMembers();
|
||||
KittyUser [] KittyMentions = new KittyUser[JDAMentions.size()];
|
||||
for(int i = 0; i < KittyMentions.length; i ++)
|
||||
{
|
||||
KittyMentions [i] = ObjectBuilderFactory.getKittyUser(event.getGuild().getId(), JDAMentions.get(i).getUser().getId());
|
||||
}
|
||||
return KittyMentions;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-23
@@ -1,21 +1,9 @@
|
||||
package main;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.security.auth.login.LoginException;
|
||||
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
|
||||
import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
|
||||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame;
|
||||
|
||||
import core.CharacterManager;
|
||||
import core.CommandEnabler;
|
||||
import core.CommandManager;
|
||||
@@ -30,17 +18,8 @@ import dataStructures.KittyGuild;
|
||||
import dataStructures.KittyUser;
|
||||
import dataStructures.Response;
|
||||
import dataStructures.UserInput;
|
||||
import net.dv8tion.jda.core.AccountType;
|
||||
import net.dv8tion.jda.core.JDA;
|
||||
import net.dv8tion.jda.core.JDABuilder;
|
||||
import net.dv8tion.jda.core.audio.AudioSendHandler;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.TextChannel;
|
||||
import net.dv8tion.jda.core.entities.VoiceChannel;
|
||||
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.core.hooks.ListenerAdapter;
|
||||
import net.dv8tion.jda.core.managers.AudioManager;
|
||||
import offline.Ref;
|
||||
import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import utils.GlobalLog;
|
||||
|
||||
// http://www.slf4j.org/ - this JDA logging tool has been disabled by specifying NOP implementation.
|
||||
|
||||
@@ -9,10 +9,11 @@ import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist;
|
||||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
import com.sedmelluq.discord.lavaplayer.track.playback.AudioFrame;
|
||||
|
||||
import net.dv8tion.jda.core.audio.AudioSendHandler;
|
||||
import net.dv8tion.jda.core.entities.Guild;
|
||||
import net.dv8tion.jda.core.entities.VoiceChannel;
|
||||
import net.dv8tion.jda.core.managers.AudioManager;
|
||||
import net.dv8tion.jda.api.audio.AudioSendHandler;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||
import net.dv8tion.jda.api.managers.AudioManager;
|
||||
|
||||
|
||||
public class AudioUtils
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user