begin update to newer JDA
This commit is contained in:
parent
22c02c6477
commit
25acb23488
|
@ -9,6 +9,7 @@
|
|||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
|
@ -28,5 +29,12 @@
|
|||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -7,7 +7,9 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
|||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
#This doesn't do anything, but is set by the program to help users identify the guild associated with the file
|
||||
Guild-Identifier = Main Config
|
||||
|
||||
#Change this to redefine the main command signifier character/String
|
||||
Command-Signifier = -
|
||||
|
||||
#Set to false to disable chat logging
|
||||
ChatLog = true
|
||||
|
||||
#Automatically places spammers in spam mode
|
||||
AllowSpamPunish = true
|
||||
|
||||
Channels-To-Not-Chatlog = ignore_me,ignore_me2,ignore_me3
|
||||
|
||||
#Bot token provided by Discord
|
||||
Bot-Token =
|
||||
|
||||
#Normal channels will have messages with these words deleted by the bot
|
||||
NaughtyList = piff,word123,another1
|
||||
|
||||
#Set to true if you want to limit the channels bot commands can be done in
|
||||
#Admins will be able to bypass this
|
||||
Restrict-Cmd-Channels = false
|
||||
|
||||
#Channels to restrict bot commands to
|
||||
CmdChannels = bot,bot2,bot3
|
||||
|
||||
#Allow users to toggle these roles
|
||||
ToggleRoles = role1,role2,role3
|
||||
|
||||
#Restrict these toggle roles to boosters. Will be removed on boost cancel
|
||||
Boost-Exclusive-Roles = role2,role3
|
||||
|
||||
#Treat these roles like booster.
|
||||
Treat-Like-Booster = Nitro Booster,silver,gold
|
||||
|
||||
#Bot can automatically assign role upon user join
|
||||
UseCustomDefaultRole = true
|
||||
|
||||
#This role will give Biscuit mod commands to users with the role
|
||||
ModRole = biscuit-key
|
||||
|
||||
#This role will give complete admin bot access to users with the role
|
||||
AdminRole = biscuit-admin
|
||||
|
||||
#In these channels, the bot will toggle roles for the ToggleRoles for anyone
|
||||
#who reacts to a message with [Toggle <Role name>]
|
||||
Toggle-Role-React-Channels = toggleroles1,toggleroles2,toggleroles3
|
||||
|
||||
#Does nothing if UseCustomDefaultRole is off
|
||||
DefaultRoleName = Standard
|
||||
|
||||
#Custom Emote to react with when action is complete
|
||||
Done-Emote = ActionComplete
|
||||
|
||||
#Set true to enable captcha
|
||||
#Use with UseCustomDefaultRole enabled
|
||||
#Will require user to have that role for captcha check
|
||||
#Role will be replaced with reward role on clear
|
||||
Captcha = false
|
||||
|
||||
#All channels listed here will allow for users in these channels
|
||||
#to initiate captcha with the bot.
|
||||
Captcha-Channels = captcha,verification
|
||||
|
||||
#Reward this role when captcha cleared
|
||||
Captcha-Reward-Role = cleared
|
||||
|
||||
#Kick if Captcha is not completed in a timely manner
|
||||
No-Captcha-Kick = false
|
||||
|
||||
#Kick user after this number of minutes has passed without captcha clear
|
||||
#Due to the way the countdown works, the kick may not happen until at most one minute after
|
||||
No-Captcha-Kick-Time = 10
|
||||
|
||||
#Messages with these unicode emotes will be removed
|
||||
Block-Unicode-Emotes = baby,snake,squid
|
||||
|
||||
#Messages with these custom emotes will be removed
|
||||
Block-Custom-Emotes = badfish,fix,bigleaf
|
||||
|
||||
#Disable these commands for ALL users
|
||||
DisabledCommands = cmd1,cmd2,cmd3
|
||||
|
||||
#Disabled these commands for normal users
|
||||
DisabledUserCommands = cmd4,cmd5,cmd6
|
||||
|
||||
#Checks which invite users join with. Requires bot to have Manage Server permission.
|
||||
Check-Join-Invite = false
|
||||
|
||||
#Enables the captcha text-channel logging.
|
||||
#Logs join, complete captcha, invite joined with, and time-out kick
|
||||
LogCaptcha = false
|
||||
|
||||
#Put the name of the text channel you want to log captcha information to.
|
||||
Captcha-Log-Channel = verify-log
|
||||
|
||||
#DM the user before kicking for captcha.
|
||||
DM-Before-Kick = true
|
||||
|
||||
#Send an invite to the server when dm-ing kicked users
|
||||
#Does nothing when blank
|
||||
#Use full link
|
||||
Kick-DM-Invite =
|
||||
|
||||
#Enable Music Bot functionality.
|
||||
#This command is for the bot admin only. If disabled, no guild
|
||||
#Will be allowed to enable and use the Music bot commands.
|
||||
Enable-Music-Bot = true
|
||||
|
||||
#Individual guild owners can enable/disable this to allow/disallow
|
||||
#Music bot features in their server. Defaults to the setting
|
||||
#Set in the main config.properties. This will do nothing if
|
||||
#Enable-Music-Bot is already set to false.
|
||||
Allow-Music-Bot = true
|
||||
|
||||
#This logs music player events to the terminal.
|
||||
#The music player logs may be annoyance. Disable them here.
|
||||
#Errors will still be logged.
|
||||
Log-Music-Player = true
|
||||
|
||||
#To restrict music to certain channels, add them here.
|
||||
#i.e:
|
||||
#Music-Channels = Room 1, Room 2
|
||||
Music-Channels =
|
||||
|
||||
#Users with this role have complete control over the music player.
|
||||
#Automatically granted to Mods and Admins.
|
||||
Music-Controller-Role = music-key
|
||||
|
||||
#List your custom commands here. This line will always generate blank.
|
||||
#Example - Custom-Command-Names = hello,botcheck,apple
|
||||
Custom-Command-Names =
|
||||
|
||||
#Placeholder(s):
|
||||
#<user> - Mentions the sender
|
||||
#Setting up custom commands works like this:
|
||||
#
|
||||
#cc-hello-message = Hello, <user>!
|
||||
#cc-hello-description = Greets the sender.
|
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.fpghoti</groupId>
|
||||
<artifactId>Biscuit</artifactId>
|
||||
<version>1.11</version>
|
||||
<version>1.13</version>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
|
@ -13,20 +13,10 @@
|
|||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.fpghoti.biscuit.Main</mainClass>
|
||||
|
@ -44,7 +34,6 @@
|
|||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<filters>
|
||||
<filter>
|
||||
|
@ -96,13 +85,15 @@
|
|||
</repositories>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.16.4-R0.1-SNAPSHOT</version>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
|
111
pom.xml
111
pom.xml
|
@ -5,7 +5,15 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.fpghoti</groupId>
|
||||
<artifactId>Biscuit</artifactId>
|
||||
<version>1.12</version>
|
||||
<version>2.0 Beta</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<resources>
|
||||
|
@ -15,32 +23,10 @@
|
|||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.fpghoti.biscuit.Main</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<version>3.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -48,38 +34,23 @@
|
|||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<minimizeJar>true</minimizeJar>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>org.tuxdude.logback.extensions:logback-colorizer</artifact>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>commons-logging:commons-logging</artifact>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
</filters>
|
||||
<transformers>
|
||||
<transformer
|
||||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>com.fpghoti.biscuit.Main</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>dv8tion</id>
|
||||
<name>m2-dv8tion</name>
|
||||
<url>https://m2.dv8tion.net/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
|
@ -92,26 +63,17 @@
|
|||
<id>oss.sonatype.org</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<name>jcenter-bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.fusesource.jansi</groupId>
|
||||
<artifactId>jansi</artifactId>
|
||||
<version>1.18</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.tuxdude.logback.extensions</groupId>
|
||||
<artifactId>logback-colorizer</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>2.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.GhotiMayo</groupId>
|
||||
|
@ -121,43 +83,38 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-configuration2</artifactId>
|
||||
<version>2.7</version>
|
||||
<version>2.11.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.16.4-R0.1-SNAPSHOT</version>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okio</groupId>
|
||||
<artifactId>okio</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<version>3.10.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.3</version>
|
||||
<version>1.5.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jcabi</groupId>
|
||||
<artifactId>jcabi-aspects</artifactId>
|
||||
<version>0.22.6</version>
|
||||
<version>0.26.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>2.3</version>
|
||||
<version>2.13.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.dv8tion</groupId>
|
||||
<artifactId>JDA</artifactId>
|
||||
<version>5.0.0-alpha.11</version>
|
||||
<version>5.3.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.cage</groupId>
|
||||
|
@ -175,14 +132,14 @@
|
|||
<version>1.4.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sedmelluq</groupId>
|
||||
<groupId>dev.arbjerg</groupId>
|
||||
<artifactId>lavaplayer</artifactId>
|
||||
<version>1.3.77</version>
|
||||
<version>2.2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.pf4j</groupId>
|
||||
<artifactId>pf4j</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<version>3.13.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -65,7 +65,7 @@ import com.fpghoti.biscuit.listener.NicknameListener;
|
|||
import com.fpghoti.biscuit.listener.ReactionListener;
|
||||
import com.fpghoti.biscuit.listener.RoleListener;
|
||||
import com.fpghoti.biscuit.logging.BColor;
|
||||
import com.fpghoti.biscuit.logging.BiscuitLog;
|
||||
import com.fpghoti.biscuit.logging.BiscuitLogger;
|
||||
import com.fpghoti.biscuit.plugin.PluginController;
|
||||
import com.github.cage.Cage;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||
|
@ -90,7 +90,7 @@ public class Main {
|
|||
public RollingFileAppender<String> we;
|
||||
public SizeAndTimeBasedRollingPolicy<String> wes;
|
||||
|
||||
private static final BiscuitLog log = new BiscuitLog();
|
||||
private static final BiscuitLogger log = new BiscuitLogger();
|
||||
|
||||
private static ArrayList<Biscuit> biscuits;
|
||||
private static Biscuit mainBiscuit;
|
||||
|
@ -224,8 +224,7 @@ public class Main {
|
|||
shardm = DefaultShardManagerBuilder.createDefault(token)
|
||||
.setChunkingFilter(ChunkingFilter.ALL)
|
||||
.setMemberCachePolicy(MemberCachePolicy.ALL)
|
||||
.enableIntents(GatewayIntent.getIntents(GatewayIntent.DEFAULT))
|
||||
.enableIntents(GatewayIntent.GUILD_MEMBERS)
|
||||
.enableIntents(GatewayIntent.getIntents(GatewayIntent.ALL_INTENTS))
|
||||
.build();
|
||||
jda = shardm.getShardById(0);
|
||||
try {
|
||||
|
@ -297,7 +296,7 @@ public class Main {
|
|||
return cage;
|
||||
}
|
||||
|
||||
public static BiscuitLog getLogger() {
|
||||
public static BiscuitLogger getLogger() {
|
||||
return log;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
|||
import com.sedmelluq.discord.lavaplayer.track.AudioTrackEndReason;
|
||||
|
||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class AudioScheduler extends AudioEventAdapter {
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
|||
import com.fpghoti.biscuit.rest.MessageText;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.VoiceChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.managers.AudioManager;
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class PlayCommandUtil {
|
|||
}
|
||||
Guild guild = event.getGuild();
|
||||
Biscuit biscuit = Biscuit.getBiscuit(guild);
|
||||
TextChannel textChannel = event.getTextChannel();
|
||||
TextChannel textChannel = event.getChannel().asTextChannel();
|
||||
|
||||
String vcname = "";
|
||||
if(!event.getMember().getVoiceState().inAudioChannel()) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.fpghoti.biscuit.rest.MessageText;
|
|||
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
||||
|
||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class AudioQueue {
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
|
|||
import net.dv8tion.jda.api.EmbedBuilder;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class QueuedTrack {
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import com.fpghoti.biscuit.audio.request.youtube.YTRequest;
|
|||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public abstract class PlayRequest {
|
||||
|
||||
|
@ -42,7 +42,7 @@ public abstract class PlayRequest {
|
|||
case YOUTUBE_PRIORITY:
|
||||
return new YTPriorityRequest(message, searchPhrase, insertSlot);
|
||||
case YOUTUBE_IMMEDIATE:
|
||||
return new YTImmediateRequest(message.getTextChannel(), message.getAuthor().getId(), searchPhrase);
|
||||
return new YTImmediateRequest(message.getChannel().asTextChannel(), message.getAuthor().getId(), searchPhrase);
|
||||
case SOUNDCLOUD:
|
||||
return new SCRequest(message, searchPhrase);
|
||||
case SOUNDCLOUD_PRIORITY:
|
||||
|
@ -58,7 +58,7 @@ public abstract class PlayRequest {
|
|||
private String identifier;
|
||||
|
||||
public PlayRequest(Message message, String identifier) {
|
||||
this(message.getTextChannel(), message.getAuthor().getId(), identifier);
|
||||
this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier);
|
||||
}
|
||||
|
||||
public PlayRequest(TextChannel channel, String authorId, String identifier) {
|
||||
|
|
|
@ -3,14 +3,14 @@ package com.fpghoti.biscuit.audio.request.soundcloud;
|
|||
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class SCPriorityRequest extends SCRequest{
|
||||
|
||||
int insertSlot;
|
||||
|
||||
public SCPriorityRequest(Message message, String identifier, int insertSlot) {
|
||||
this(message.getTextChannel(), message.getAuthor().getId(), identifier, insertSlot);
|
||||
this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier, insertSlot);
|
||||
}
|
||||
|
||||
public SCPriorityRequest(TextChannel channel, String authorId, String identifier, int insertSlot) {
|
||||
|
|
|
@ -4,14 +4,14 @@ import com.fpghoti.biscuit.audio.request.PlayRequest;
|
|||
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class SCRequest extends PlayRequest{
|
||||
|
||||
private boolean searchMode;
|
||||
|
||||
public SCRequest(Message message, String identifier) {
|
||||
this(message.getTextChannel(), message.getAuthor().getId(), identifier);
|
||||
this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier);
|
||||
}
|
||||
|
||||
public SCRequest(TextChannel channel, String authorId, String identifier) {
|
||||
|
|
|
@ -3,7 +3,8 @@ package com.fpghoti.biscuit.audio.request.youtube;
|
|||
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class YTImmediateRequest extends YTRequest{
|
||||
|
||||
|
|
|
@ -3,14 +3,14 @@ package com.fpghoti.biscuit.audio.request.youtube;
|
|||
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class YTPriorityRequest extends YTRequest{
|
||||
|
||||
int insertSlot;
|
||||
|
||||
public YTPriorityRequest(Message message, String identifier, int insertSlot) {
|
||||
this(message.getTextChannel(), message.getAuthor().getId(), identifier, insertSlot);
|
||||
this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier, insertSlot);
|
||||
}
|
||||
|
||||
public YTPriorityRequest(TextChannel channel, String authorId, String identifier, int insertSlot) {
|
||||
|
|
|
@ -4,14 +4,15 @@ import com.fpghoti.biscuit.audio.request.PlayRequest;
|
|||
import com.fpghoti.biscuit.audio.request.RequestType;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class YTRequest extends PlayRequest{
|
||||
|
||||
private boolean searchMode;
|
||||
|
||||
public YTRequest(Message message, String identifier) {
|
||||
this(message.getTextChannel(), message.getAuthor().getId(), identifier);
|
||||
this(message.getChannel().asTextChannel(), message.getAuthor().getId(), identifier);
|
||||
}
|
||||
|
||||
public YTRequest(TextChannel channel, String authorId, String identifier) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import com.fpghoti.biscuit.audio.AudioScheduler;
|
|||
import com.fpghoti.biscuit.config.BiscuitConfig;
|
||||
import com.fpghoti.biscuit.config.BiscuitProperties;
|
||||
import com.fpghoti.biscuit.logging.BColor;
|
||||
import com.fpghoti.biscuit.logging.BiscuitLog;
|
||||
import com.fpghoti.biscuit.logging.BiscuitLogger;
|
||||
import com.fpghoti.biscuit.rest.MessageText;
|
||||
import com.fpghoti.biscuit.timer.BiscuitTimer;
|
||||
import com.fpghoti.biscuit.timer.task.ChatCountTimer;
|
||||
|
@ -29,9 +29,11 @@ import net.dv8tion.jda.api.entities.Guild;
|
|||
import net.dv8tion.jda.api.entities.Invite;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
||||
|
||||
public class Biscuit {
|
||||
|
||||
public static Biscuit getBiscuit(Guild g) {
|
||||
|
@ -77,7 +79,7 @@ public class Biscuit {
|
|||
|
||||
private boolean isMain;
|
||||
private JDA jda;
|
||||
private BiscuitLog logger;
|
||||
private BiscuitLogger logger;
|
||||
private Timer timer;
|
||||
private List<BiscuitTimer> timers;
|
||||
private File captchaDir;
|
||||
|
@ -93,7 +95,7 @@ public class Biscuit {
|
|||
private CopyOnWriteArrayList<PreUser> users = new CopyOnWriteArrayList<PreUser>();
|
||||
private HashMap<Member, Role> rolequeue;
|
||||
|
||||
public Biscuit(JDA jda, Guild guild, BiscuitLog log) {
|
||||
public Biscuit(JDA jda, Guild guild, BiscuitLogger log) {
|
||||
this.jda = jda;
|
||||
this.guild = guild;
|
||||
this.logger = log;
|
||||
|
|
|
@ -17,10 +17,11 @@ import com.github.cage.Cage;
|
|||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.PrivateChannel;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
import net.dv8tion.jda.api.utils.FileUpload;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
|
||||
public class Captcha {
|
||||
|
@ -102,10 +103,11 @@ public class Captcha {
|
|||
genToken();
|
||||
generateImage();
|
||||
File captcha = getImageFile();
|
||||
FileUpload capUpload = FileUpload.fromData(captcha);
|
||||
|
||||
respond("Respond with the exact text in this image.");
|
||||
channel.sendFile(captcha).submit();
|
||||
|
||||
//channel.sendFile(captcha).submit();
|
||||
channel.sendFiles(capUpload);
|
||||
}else {
|
||||
boolean disable = false;
|
||||
if(captchaUser.inTestMode()) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import com.fpghoti.biscuit.util.PermUtil;
|
|||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
|
||||
public class HandleCaptcha {
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ public class CommandManager {
|
|||
|
||||
public static void commandReply(MessageReceivedEvent event, String msg) {
|
||||
if(event != null) {
|
||||
MessageText.send(event.getTextChannel(), msg);
|
||||
MessageText.send(event.getChannel().asTextChannel(), msg);
|
||||
}else {
|
||||
Main.getLogger().info(msg);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import com.fpghoti.biscuit.commands.base.ConsoleCommand;
|
|||
import com.fpghoti.biscuit.rest.MessageText;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class GuildSayCommand extends ConsoleCommand{
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ import com.fpghoti.biscuit.commands.base.ConsoleCommand;
|
|||
import com.fpghoti.biscuit.rest.MessageText;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class SayCommand extends ConsoleCommand{
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
|
|||
import com.fpghoti.biscuit.rest.MessageText;
|
||||
import com.fpghoti.biscuit.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class AddCommand extends ClientCommand{
|
||||
|
@ -31,7 +32,7 @@ public class AddCommand extends ClientCommand{
|
|||
if(end.equals(".0")) {
|
||||
sum = sum.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + " + " + args[1] + " is **" + sum + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + " + " + args[1] + " is **" + sum + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class ChanIDCommand extends ClientCommand{
|
|||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -chanid");
|
||||
String id = event.getChannel().getId();
|
||||
MessageText.send(event.getTextChannel(), id);
|
||||
MessageText.send(event.getChannel().asTextChannel(), id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class DivideCommand extends ClientCommand{
|
|||
if(end.equals(".0")) {
|
||||
divide = divide.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + " / " + args[1] + " is **" + divide + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + " / " + args[1] + " is **" + divide + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.fpghoti.biscuit.commands.discord;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.commands.base.ClientCommand;
|
||||
|
@ -8,6 +10,7 @@ import com.fpghoti.biscuit.rest.MessageText;
|
|||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.utils.FileUpload;
|
||||
|
||||
public class GetConfigCommand extends ClientCommand{
|
||||
|
||||
|
@ -25,10 +28,14 @@ public class GetConfigCommand extends ClientCommand{
|
|||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -getconfig");
|
||||
if(PermUtil.isAdmin(event.getMember())) {
|
||||
event.getChannel().sendFile(b.getConfig().getFile(), "config-" + b.getProperties().getGuildCode() + ".properties").queue();
|
||||
File config = b.getConfig().getFile();
|
||||
FileUpload confUpload = FileUpload.fromData(config);
|
||||
confUpload.setName("config-" + b.getProperties().getGuildCode() + ".properties");
|
||||
//event.getChannel().sendFile(config, "config-" + b.getProperties().getGuildCode() + ".properties").queue();
|
||||
event.getChannel().asTextChannel().sendFiles(confUpload);
|
||||
}else {
|
||||
b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to view the config!");
|
||||
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You do not have "
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " You do not have "
|
||||
+ "permission to view the config.", 5);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public class GuildIDCommand extends ClientCommand{
|
|||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -guildid");
|
||||
if(PermUtil.isMod(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), event.getGuild().getId());
|
||||
MessageText.send(event.getChannel().asTextChannel(), event.getGuild().getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class HelpCommand extends ClientCommand {
|
|||
if(Util.isDigit(args[0])) {
|
||||
pg = Integer.parseInt(args[0]);
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "Usage: ``" + usage + "``");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Usage: ``" + usage + "``");
|
||||
}
|
||||
}
|
||||
List<BaseCommand> commands = new ArrayList<BaseCommand>();
|
||||
|
@ -66,8 +66,8 @@ public class HelpCommand extends ClientCommand {
|
|||
pg = pageCount;
|
||||
}
|
||||
|
||||
MessageText.send(event.getTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**");
|
||||
MessageText.send(event.getTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "help [Page #] to navigate the different pages.**");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] **Bot Commands:**");
|
||||
String msg = "";
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int index = (pg - 1) * 8 + i;
|
||||
|
@ -82,7 +82,7 @@ public class HelpCommand extends ClientCommand {
|
|||
msg = msg + line;
|
||||
}
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), msg);
|
||||
MessageText.send(event.getChannel().asTextChannel(), msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@ import com.fpghoti.biscuit.util.PermUtil;
|
|||
import com.fpghoti.biscuit.util.Util;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class MakeInviteCommand extends ClientCommand{
|
||||
|
@ -40,7 +41,7 @@ public class MakeInviteCommand extends ClientCommand{
|
|||
}
|
||||
}
|
||||
if(doubAge > 86400) {
|
||||
MessageText.send(event.getTextChannel(), "That length is longer than what Discord allows. Please try again. (Max 24 hours)");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "That length is longer than what Discord allows. Please try again. (Max 24 hours)");
|
||||
return;
|
||||
}
|
||||
final double db = doubAge;
|
||||
|
@ -50,7 +51,7 @@ public class MakeInviteCommand extends ClientCommand{
|
|||
if(db > 0) {
|
||||
exp = args[1] + " hour(s)";
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), "Created invite **" + i.getCode() + "** Expiration: **" + exp + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Created invite **" + i.getCode() + "** Expiration: **" + exp + "**.");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class MultiplyCommand extends ClientCommand{
|
|||
if(end.equals(".0")) {
|
||||
prod = prod.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + " x " + args[1] + " is **" + prod + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + " x " + args[1] + " is **" + prod + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@ public class NotSpammerCommand extends ClientCommand{
|
|||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -notspammer " + args[0]);
|
||||
for(Member m : event.getMessage().getMentionedMembers()){
|
||||
for(Member m : event.getMessage().getMentions().getMembers()){
|
||||
User u = m.getUser();
|
||||
String s = u.getAsMention();
|
||||
if(event.getChannel().getName().equals("public-spam-test") || (PermUtil.isMod(event.getMember()))) {
|
||||
b.getMessageStore().removeSpammer(u);
|
||||
MessageText.send(event.getTextChannel(), s + " is no longer flagged as spam.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), s + " is no longer flagged as spam.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class PingCommand extends ClientCommand{
|
|||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -ping");
|
||||
MessageText.send(event.getTextChannel(), "Pong!");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Pong!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class PowerCommand extends ClientCommand{
|
|||
if(end.equals(".0")) {
|
||||
pow = pow.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + "^" + args[1] + " is **" + pow + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + "^" + args[1] + " is **" + pow + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class RecentSpammersCommand extends ClientCommand{
|
|||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -recentspammers");
|
||||
String msg = b.getMessageStore().getSpammerList();
|
||||
MessageText.send(event.getTextChannel(), msg);
|
||||
MessageText.send(event.getChannel().asTextChannel(), msg);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,21 +32,21 @@ public class SaveConfigCommand extends ClientCommand{
|
|||
if(!attch.isEmpty()) {
|
||||
if(attch.size() == 1) {
|
||||
for(Attachment a : attch) {
|
||||
b.getConfig().replaceConfig(a, event.getTextChannel());
|
||||
b.getConfig().replaceConfig(a, event.getChannel().asTextChannel());
|
||||
b.remove();
|
||||
b = Biscuit.loadGuild(event.getGuild());
|
||||
}
|
||||
}else {
|
||||
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " Too many attachments added! "
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " Too many attachments added! "
|
||||
+ "Please only include the config file you want to save.", 5);
|
||||
}
|
||||
}else {
|
||||
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You need to send "
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " You need to send "
|
||||
+ "a file in order to save the config.", 5);
|
||||
}
|
||||
}else {
|
||||
b.log(BColor.MAGENTA_BOLD + event.getAuthor().getName() + " lacks permission to save the config!");
|
||||
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " You do not have "
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " You do not have "
|
||||
+ "permission to save the config.", 5);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,17 +25,17 @@ public class SoftMuteCommand extends ClientCommand{
|
|||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -softmute " + args[0]);
|
||||
for(Member m : event.getMessage().getMentionedMembers()){
|
||||
for(Member m : event.getMessage().getMentions().getMembers()){
|
||||
User u = m.getUser();
|
||||
String s = u.getAsMention();
|
||||
if(b.getMessageStore().isSoftmuted(u)) {
|
||||
MessageText.sendTimed(event.getTextChannel(), s + " is already softmuted.", 3);
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), s + " is already softmuted.", 3);
|
||||
return;
|
||||
}
|
||||
if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) {
|
||||
b.getMessageStore().addSoftmuted(u);
|
||||
u.openPrivateChannel().queue();
|
||||
MessageText.send(event.getTextChannel(), s + " is now soft-muted. They will now be only able to send one message every two minutes.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), s + " is now soft-muted. They will now be only able to send one message every two minutes.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class SquareRootCommand extends ClientCommand{
|
|||
if(end.equals(".0")) {
|
||||
root = root.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), "The sqaure root of " + args[0] + " is **" + root + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The sqaure root of " + args[0] + " is **" + root + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class SubtractCommand extends ClientCommand{
|
|||
if(end.equals(".0")) {
|
||||
sub = sub.replace(".0","");
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), args[0] + " - " + args[1] + " is **" + sub + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), args[0] + " - " + args[1] + " is **" + sub + "**.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@ import com.fpghoti.biscuit.commands.base.ClientCommand;
|
|||
import com.fpghoti.biscuit.rest.MessageText;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.Role;
|
||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||
import net.dv8tion.jda.api.entities.emoji.EmojiUnion;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class ToggleRoleCommand extends ClientCommand{
|
||||
|
@ -38,7 +39,7 @@ public class ToggleRoleCommand extends ClientCommand{
|
|||
}
|
||||
|
||||
if(rolename.equals("")) {
|
||||
MessageText.send(event.getTextChannel(), "Sorry! This role either cannot be toggled or does not exist!");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Sorry! This role either cannot be toggled or does not exist!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -53,8 +54,8 @@ public class ToggleRoleCommand extends ClientCommand{
|
|||
return;
|
||||
}
|
||||
|
||||
Emote done = null;
|
||||
for(Emote e : event.getGuild().getEmotes()) {
|
||||
Emoji done = null;
|
||||
for(Emoji e : event.getMessage().getMentions().getCustomEmojis()) {
|
||||
if(e.getName().contains(b.getProperties().getDoneEmote())) {
|
||||
done = e;
|
||||
}
|
||||
|
@ -80,7 +81,8 @@ public class ToggleRoleCommand extends ClientCommand{
|
|||
if(foundEmote) {
|
||||
event.getMessage().addReaction(done).queue();
|
||||
}else {
|
||||
event.getMessage().addReaction("✔").queue();
|
||||
//event.getMessage().addReaction("✔").queue();
|
||||
event.getMessage().addReaction(Emoji.fromFormatted("U+2714")).queue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@ public class UIDCommand extends ClientCommand{
|
|||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -uid " + args[0]);
|
||||
for(Member m : event.getMessage().getMentionedMembers()){
|
||||
for(Member m : event.getMessage().getMentions().getMembers()){
|
||||
User u = m.getUser();
|
||||
if(PermUtil.isMod(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), u.getId());
|
||||
MessageText.send(event.getChannel().asTextChannel(), u.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,12 +25,12 @@ public class UnSoftMuteCommand extends ClientCommand{
|
|||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -unsoftmute " + args[0]);
|
||||
for(Member m : event.getMessage().getMentionedMembers()){
|
||||
for(Member m : event.getMessage().getMentions().getMembers()){
|
||||
User u = m.getUser();
|
||||
String s = u.getAsMention();
|
||||
if(event.getChannel().getName().equals("public-softmute-test") || (PermUtil.isMod(event.getMember()))) {
|
||||
b.getMessageStore().removeSoftmuted(u);
|
||||
MessageText.send(event.getTextChannel(), s + " is no longer soft-muted.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), s + " is no longer soft-muted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class WikiCommand extends ClientCommand{
|
|||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -wiki");
|
||||
if(PermUtil.isMod(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), "https://git.fpghoti.com/thmsdy/Biscuit/wiki");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "https://git.fpghoti.com/thmsdy/Biscuit/wiki");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ClearCommand extends MusicClientCommand{
|
|||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -clear");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), "Cleared all upcoming songs from the queue.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Cleared all upcoming songs from the queue.");
|
||||
b.getAudioScheduler().getQueue().clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ public class ClearUserSongsCommand extends MusicClientCommand{
|
|||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -clearusersongs " + args[0]);
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
for(Member m : event.getMessage().getMentionedMembers()) {
|
||||
MessageText.send(event.getTextChannel(), "Clearing all upcoming tracks added by **" + m.getEffectiveName() + "**.");
|
||||
for(Member m : event.getMessage().getMentions().getMembers()) {
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Clearing all upcoming tracks added by **" + m.getEffectiveName() + "**.");
|
||||
b.getAudioScheduler().getQueue().removeUserTracks(m.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ public class ForceSkipCommand extends MusicClientCommand{
|
|||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -forceskip");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), "Force skipping current song.");
|
||||
b.getAudioScheduler().skip(event.getTextChannel());
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Force skipping current song.");
|
||||
b.getAudioScheduler().skip(event.getChannel().asTextChannel());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ public class ForceSkipToCommand extends MusicClientCommand{
|
|||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(Util.isDigit(args[0])) {
|
||||
int place = Integer.parseInt(args[0]);
|
||||
MessageText.send(event.getTextChannel(), "Force skipping to queue position **" + place + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Force skipping to queue position **" + place + "**.");
|
||||
b.getAudioScheduler().getQueue().removeTracksBefore(place);
|
||||
b.getAudioScheduler().skip(event.getTextChannel());
|
||||
b.getAudioScheduler().skip(event.getChannel().asTextChannel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@ public class LoopMusicCommand extends MusicClientCommand{
|
|||
b.log(event.getAuthor().getName() + " issued a command: -loopmusic");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(!b.getAudioScheduler().isLooping()) {
|
||||
MessageText.send(event.getTextChannel(), "Setting all music to loop.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Setting all music to loop.");
|
||||
b.getAudioScheduler().setLooping(true);
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "Disabling music looping.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Disabling music looping.");
|
||||
b.getAudioScheduler().setLooping(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ public class MoveToCommand extends MusicClientCommand{
|
|||
if(Util.isDigit(args[0]) && Util.isDigit(args[1])) {
|
||||
int oldPlace = Integer.parseInt(args[0]);
|
||||
int newPlace = Integer.parseInt(args[1]);
|
||||
MessageText.send(event.getTextChannel(), "The specified track was moved." );
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The specified track was moved." );
|
||||
b.getAudioScheduler().getQueue().moveToPlace(oldPlace, newPlace);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,9 +25,9 @@ public class NowPlayingCommand extends MusicClientCommand{
|
|||
b.log(event.getAuthor().getName() + " issued a command: -nowplaying");
|
||||
if(b.getAudioScheduler().getQueue().getLastTrack() != null ) {
|
||||
MessageEmbed next = b.getAudioScheduler().getQueue().getLastTrack().getEmbedMessage("Now Playing:", true);
|
||||
MessageText.send(event.getTextChannel(), next);
|
||||
MessageText.send(event.getChannel().asTextChannel(), next);
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "No song is currently playing.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "No song is currently playing.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ public class PauseCommand extends MusicClientCommand{
|
|||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(!b.getAudioPlayer().isPaused()) {
|
||||
b.getAudioPlayer().setPaused(true);
|
||||
MessageText.send(event.getTextChannel(), "Paused the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Paused the current track.");
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "The music player is already paused.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The music player is already paused.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@ import com.fpghoti.biscuit.rest.MessageText;
|
|||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
//import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class PlayFirstCommand extends MusicClientCommand{
|
||||
|
@ -33,7 +34,7 @@ public class PlayFirstCommand extends MusicClientCommand{
|
|||
public void execute(String[] args, MessageReceivedEvent event) {
|
||||
Guild guild = event.getGuild();
|
||||
Biscuit b = Biscuit.getBiscuit(guild);
|
||||
TextChannel tchannel = event.getTextChannel();
|
||||
TextChannel tchannel = event.getChannel().asTextChannel();
|
||||
|
||||
int searchArg = 0;
|
||||
boolean scSearch = false;
|
||||
|
|
|
@ -33,7 +33,7 @@ public class QueueCommand extends MusicClientCommand{
|
|||
if(Util.isDigit(args[0])) {
|
||||
pg = Integer.parseInt(args[0]);
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "Usage: ``" + usage + "``");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Usage: ``" + usage + "``");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,15 +46,15 @@ public class QueueCommand extends MusicClientCommand{
|
|||
|
||||
if(queue.size() == 0) {
|
||||
if(biscuit.getAudioPlayer().getPlayingTrack() == null) {
|
||||
MessageText.send(event.getTextChannel(), "There is currently no song playing.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "There is currently no song playing.");
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "Nothing is queued to play after the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Nothing is queued to play after the current track.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
MessageText.send(event.getTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**");
|
||||
MessageText.send(event.getTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "**Use " + Main.getMainBiscuit().getProperties().getCommandSignifier() + "queue [Page #] to navigate the different pages.**");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] ** Upcoming Music Tracks:**");
|
||||
String msg = "";
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int index = (pg - 1) * 8 + i;
|
||||
|
@ -76,7 +76,7 @@ public class QueueCommand extends MusicClientCommand{
|
|||
msg = msg + line;
|
||||
}
|
||||
}
|
||||
MessageText.send(event.getTextChannel(), msg);
|
||||
MessageText.send(event.getChannel().asTextChannel(), msg);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public class RemoveCommand extends MusicClientCommand{
|
|||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(Util.isDigit(args[0])) {
|
||||
int place = Integer.parseInt(args[0]);
|
||||
MessageText.send(event.getTextChannel(), "Removing track at position **" + place + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Removing track at position **" + place + "**.");
|
||||
b.getAudioScheduler().getQueue().removeTrack(place);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ public class ShuffleCommand extends MusicClientCommand{
|
|||
b.log(event.getAuthor().getName() + " issued a command: -shuffle");
|
||||
if(b.getAudioScheduler().getQueue().getLastTrack() != null ) {
|
||||
b.getAudioScheduler().getQueue().shuffleUserTracks(event.getAuthor().getId());
|
||||
MessageText.send(event.getTextChannel(), "All songs that you have added to the queue have been shuffled.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "All songs that you have added to the queue have been shuffled.");
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "No song is currently playing.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "No song is currently playing.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ public class SkipAllCommand extends MusicClientCommand{
|
|||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
b.log(event.getAuthor().getName() + " issued a command: -skipall");
|
||||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
MessageText.send(event.getTextChannel(), "Force skipping all songs.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Force skipping all songs.");
|
||||
b.getAudioScheduler().getQueue().clear();
|
||||
b.getAudioScheduler().skip(event.getTextChannel());
|
||||
b.getAudioScheduler().skip(event.getChannel().asTextChannel());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
|||
import com.fpghoti.biscuit.commands.base.MusicClientCommand;
|
||||
import com.fpghoti.biscuit.rest.MessageText;
|
||||
|
||||
import net.dv8tion.jda.api.entities.AudioChannel;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class SkipCommand extends MusicClientCommand{
|
||||
|
@ -32,11 +32,11 @@ public class SkipCommand extends MusicClientCommand{
|
|||
Biscuit biscuit = Biscuit.getBiscuit(guild);
|
||||
biscuit.log(event.getAuthor().getName() + " issued a command: -skip");
|
||||
|
||||
TextChannel cmdChannel = event.getTextChannel();
|
||||
TextChannel cmdChannel = event.getChannel().asTextChannel();
|
||||
|
||||
//Bot is not connected to voice channel. Do nothing.
|
||||
if(!guild.getAudioManager().isConnected()) {
|
||||
MessageText.send(event.getTextChannel(), "The music player is not connected to a voice channel!");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The music player is not connected to a voice channel!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,10 +27,10 @@ public class TogglePauseCommand extends MusicClientCommand{
|
|||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(b.getAudioPlayer().isPaused()) {
|
||||
b.getAudioPlayer().setPaused(false);
|
||||
MessageText.send(event.getTextChannel(), "Unpaused the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Unpaused the current track.");
|
||||
}else {
|
||||
b.getAudioPlayer().setPaused(true);
|
||||
MessageText.send(event.getTextChannel(), "Paused the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Paused the current track.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ public class UnpauseCommand extends MusicClientCommand{
|
|||
if(PermUtil.hasMusicControl(event.getMember())) {
|
||||
if(b.getAudioPlayer().isPaused()) {
|
||||
b.getAudioPlayer().setPaused(false);
|
||||
MessageText.send(event.getTextChannel(), "Unpaused the current track.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "Unpaused the current track.");
|
||||
}else {
|
||||
MessageText.send(event.getTextChannel(), "The music player is not paused.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The music player is not paused.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class VolumeCommand extends MusicClientCommand{
|
|||
|
||||
if(args.length < 1) {
|
||||
b.log(event.getAuthor().getName() + " issued a command: -volume");
|
||||
MessageText.send(event.getTextChannel(), "The current volume is: **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The current volume is: **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class VolumeCommand extends MusicClientCommand{
|
|||
vol = 150;
|
||||
}
|
||||
b.getAudioPlayer().setVolume(vol);
|
||||
MessageText.send(event.getTextChannel(), "The volume was set to **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
MessageText.send(event.getChannel().asTextChannel(), "The volume was set to **" + b.getAudioPlayer().getVolume() + "**.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import com.jcabi.aspects.Async;
|
|||
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Message.Attachment;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class BiscuitConfig {
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class BiscuitConfig {
|
|||
return;
|
||||
}
|
||||
File config = new File(biscuit.getConfigDir(), name);
|
||||
a.downloadToFile(config).thenAccept(file -> {
|
||||
a.getProxy().downloadToFile(config).thenAccept(file -> {
|
||||
updateConfig(file, true, code);
|
||||
MessageText.send(c, "**The config was successfully updated.**");
|
||||
}).exceptionally(t -> {
|
||||
|
@ -82,6 +82,7 @@ public class BiscuitConfig {
|
|||
MessageText.send(c, "**An Exception occurred while trying to read the file.**");
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -135,6 +136,7 @@ public class BiscuitConfig {
|
|||
added = addProperty("Bot-Token", "", prop, added, silent);
|
||||
added = addProperty("Enable-Music-Bot", "true", prop, added, silent);
|
||||
added = addProperty("Log-Music-Player", "true", prop, added, silent);
|
||||
added = addProperty("Powershell-Display-Mode", "false", prop, added, silent);
|
||||
}
|
||||
|
||||
added = addProperty("Guild-Identifier", name, prop, added, silent);
|
||||
|
|
|
@ -32,6 +32,11 @@ public class BiscuitProperties {
|
|||
return Main.getMainBiscuit().getConfig().getFromConfig(key).equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public boolean isPowerShell(){
|
||||
String key = "Powershell-Display-Mode";
|
||||
return Main.getMainBiscuit().getConfig().getFromConfig(key).equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
public boolean allowMusicBot(){
|
||||
if(!musicBotEnabled()) {
|
||||
return false;
|
||||
|
|
|
@ -4,19 +4,19 @@ import java.util.Scanner;
|
|||
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.commands.CommandManager;
|
||||
import com.fpghoti.biscuit.logging.BiscuitLog;
|
||||
import com.fpghoti.biscuit.logging.BiscuitLogger;
|
||||
import com.fpghoti.biscuit.util.PermUtil;
|
||||
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
public class CommandListener extends ListenerAdapter implements Runnable {
|
||||
|
||||
private Scanner sc;
|
||||
private BiscuitLog log;
|
||||
private BiscuitLogger log;
|
||||
|
||||
public CommandListener(Scanner sc, BiscuitLog log) {
|
||||
public CommandListener(Scanner sc, BiscuitLogger log) {
|
||||
this.sc = sc;
|
||||
this.log = log;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class CommandListener extends ListenerAdapter implements Runnable {
|
|||
return;
|
||||
}
|
||||
Biscuit b = Biscuit.getBiscuit(event.getGuild());
|
||||
if(PermUtil.isAdmin(event.getMember()) || !b.getProperties().restrictCmdChannels() || (b.getProperties().restrictCmdChannels() && isBotChannel(event.getTextChannel()))) {
|
||||
if(PermUtil.isAdmin(event.getMember()) || !b.getProperties().restrictCmdChannels() || (b.getProperties().restrictCmdChannels() && isBotChannel(event.getChannel().asTextChannel()))) {
|
||||
if(!event.getAuthor().isBot() && event.getMessage().getContentDisplay().startsWith(b.getProperties().getCommandSignifier()) && event.getMessage().getAuthor().getId() != event.getJDA().getSelfUser().getId()){
|
||||
CommandManager.parse(event.getMessage().getContentRaw().toLowerCase(), event);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.fpghoti.biscuit.Main;
|
|||
import com.fpghoti.biscuit.captcha.HandleCaptcha;
|
||||
import com.fpghoti.biscuit.logging.BColor;
|
||||
|
||||
import net.dv8tion.jda.api.entities.ChannelType;
|
||||
import net.dv8tion.jda.api.entities.channel.ChannelType;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ public class MessageDeleteListener extends ListenerAdapter {
|
|||
@Override
|
||||
public void onMessageDelete(MessageDeleteEvent event) {
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
if(Util.isLoggable(event.getTextChannel())) {
|
||||
if(Util.isLoggable(event.getChannel().asTextChannel())) {
|
||||
biscuit.log("[" + BColor.MAGENTA + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.MAGENTA_BOLD + "Message " + event.getMessageId() + " was deleted.");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public class MessageEditListener extends ListenerAdapter {
|
|||
@Override
|
||||
public void onMessageUpdate(MessageUpdateEvent event) {
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
if(Util.isLoggable(event.getTextChannel()) && (!event.getAuthor().getName().equalsIgnoreCase("jbot") && !event.getAuthor().isBot())) {
|
||||
if(Util.isLoggable(event.getChannel().asTextChannel()) && (!event.getAuthor().getName().equalsIgnoreCase("jbot") && !event.getAuthor().isBot())) {
|
||||
biscuit.log("[" + BColor.CYAN_BOLD + "MSG EDIT" + BColor.RESET + "] " + BColor.CYAN + "ID: " + BColor.RESET +
|
||||
event.getMessageId() + BColor.CYAN + " User: " + BColor.RESET + event.getAuthor().getAsMention());
|
||||
biscuit.log("[" + BColor.CYAN_BOLD + "#" + event.getChannel().getName() + BColor.RESET + "] " + BColor.CYAN + event.getAuthor().getName() + ": " + BColor.WHITE_BOLD + event.getMessage().getContentDisplay());
|
||||
|
|
|
@ -42,14 +42,14 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
}
|
||||
|
||||
//Channel is a captcha channel
|
||||
if(HandleCaptcha.isCaptchaChannel(event.getTextChannel())) {
|
||||
if(HandleCaptcha.isCaptchaChannel(event.getChannel().asTextChannel())) {
|
||||
HandleCaptcha.handleCaptcha(event.getAuthor(), event.getChannel(), event.getMessage().getContentDisplay());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void logBot(MessageReceivedEvent event, Biscuit biscuit) {
|
||||
if(Util.isLoggable(event.getTextChannel())) {
|
||||
if(Util.isLoggable(event.getChannel().asTextChannel())) {
|
||||
if(biscuit.getProperties().logChat()) {
|
||||
biscuit.log("[" + BColor.BLACK_BOLD + "BOT" + BColor.RESET + "] [" + BColor.RED + "#" + event.getChannel().getName() + BColor.RESET + "] "
|
||||
+ BColor.RED_BOLD + event.getAuthor().getName() + ": " + BColor.RESET + event.getMessage().getContentDisplay());
|
||||
|
@ -58,7 +58,7 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
}
|
||||
|
||||
private void logUser(MessageReceivedEvent event, Biscuit biscuit) {
|
||||
if(Util.isLoggable(event.getTextChannel())) {
|
||||
if(Util.isLoggable(event.getChannel().asTextChannel())) {
|
||||
if(biscuit.getProperties().logChat()) {
|
||||
biscuit.log("[" + BColor.CYAN_BOLD + "MSG" + BColor.RESET + "] " + BColor.GREEN + "ID: " + BColor.RESET +
|
||||
event.getMessageId() + BColor.GREEN + " Sender: " + BColor.RESET + event.getAuthor().getAsMention());
|
||||
|
@ -83,7 +83,7 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
private boolean isNaughty(MessageReceivedEvent event) {
|
||||
// TODO make staff filter configurable
|
||||
if(!event.getChannel().getName().toLowerCase().contains("staff") && ChatFilter.filter(event, false)){
|
||||
MessageText.sendTimed(event.getTextChannel(), event.getAuthor().getAsMention() + " This message contains words not appropriate for this channel.", 3);
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), event.getAuthor().getAsMention() + " This message contains words not appropriate for this channel.", 3);
|
||||
event.getMessage().delete().submit();
|
||||
return true;
|
||||
}
|
||||
|
@ -151,14 +151,14 @@ public class MessageReceiveListener extends ListenerAdapter{
|
|||
store.addSpammer(event.getAuthor());
|
||||
store.removeSpamWarned(event.getAuthor());
|
||||
event.getMessage().delete().submit();
|
||||
MessageText.sendTimed(event.getTextChannel(), "*Flagging " + mention + " as spam!*", 3);
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), "*Flagging " + mention + " as spam!*", 3);
|
||||
biscuit.log(BColor.MAGENTA_BOLD + "User " + event.getAuthor().getName() + " has been flagged as spam!");
|
||||
event.getMessage().delete().reason("Spam removal activated for " + mention).submit();
|
||||
//User is spamming and has not been warned. Apply warning.
|
||||
}else if(!store.isSpammer(event.getAuthor()) && !store.isSpamWarned(event.getAuthor())){
|
||||
store.removeMessageCount(event.getAuthor());
|
||||
store.addSpamWarned(event.getAuthor());
|
||||
MessageText.sendTimed(event.getTextChannel(), "**STOP spamming, " + mention + "! You have been warned!**", 3);
|
||||
MessageText.sendTimed(event.getChannel().asTextChannel(), "**STOP spamming, " + mention + "! You have been warned!**", 3);
|
||||
biscuit.log(BColor.MAGENTA_BOLD + "User " + event.getAuthor().getName() + " has been warned for spam!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ReactionListener extends ListenerAdapter{
|
|||
if(event.getGuild() == null) {
|
||||
return;
|
||||
}
|
||||
if(Util.contains(biscuit.getProperties().getToggleChannels(),event.getTextChannel().getName())) {
|
||||
if(Util.contains(biscuit.getProperties().getToggleChannels(),event.getChannel().asTextChannel().getName())) {
|
||||
handleMessageRole(event, false);
|
||||
}
|
||||
}
|
||||
|
@ -32,14 +32,14 @@ public class ReactionListener extends ListenerAdapter{
|
|||
if(event.getGuild() == null) {
|
||||
return;
|
||||
}
|
||||
if(Util.contains(biscuit.getProperties().getToggleChannels(),event.getTextChannel().getName())) {
|
||||
if(Util.contains(biscuit.getProperties().getToggleChannels(),event.getChannel().asTextChannel().getName())) {
|
||||
handleMessageRole(event, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleMessageRole(GenericMessageReactionEvent event, boolean remove) {
|
||||
Biscuit biscuit = Biscuit.getBiscuit(event.getGuild());
|
||||
event.getTextChannel().retrieveMessageById(event.getMessageId()).queue((message) -> {
|
||||
event.getChannel().asTextChannel().retrieveMessageById(event.getMessageId()).queue((message) -> {
|
||||
String msg = message.getContentDisplay();
|
||||
for(String rolename : biscuit.getProperties().getToggleRoles()) {
|
||||
for(Role r : event.getGuild().getRoles()) {
|
||||
|
@ -65,7 +65,7 @@ public class ReactionListener extends ListenerAdapter{
|
|||
Member m = event.getMember();
|
||||
if(remove) {
|
||||
if(PermUtil.hasRole(m, role)) {
|
||||
biscuit.log(BColor.MAGENTA_BOLD + "REACTION TOGGLE (#" + event.getTextChannel().getName() + ") - " + BColor.RESET + "Removing role " + role.getName() + " from " + m.getUser().getName() + "(" + m.getId() + ")");
|
||||
biscuit.log(BColor.MAGENTA_BOLD + "REACTION TOGGLE (#" + event.getChannel().asTextChannel().getName() + ") - " + BColor.RESET + "Removing role " + role.getName() + " from " + m.getUser().getName() + "(" + m.getId() + ")");
|
||||
guild.removeRoleFromMember(m, role).queue();
|
||||
}
|
||||
}else {
|
||||
|
@ -80,7 +80,7 @@ public class ReactionListener extends ListenerAdapter{
|
|||
canAdd = true;
|
||||
}
|
||||
if(canAdd) {
|
||||
biscuit.log(BColor.MAGENTA_BOLD + "REACTION TOGGLE (#" + event.getTextChannel().getName() + ") - " + BColor.RESET + " Adding role " + role.getName() + " to " + m.getUser().getName() + "(" + m.getId() + ")");
|
||||
biscuit.log(BColor.MAGENTA_BOLD + "REACTION TOGGLE (#" + event.getChannel().asTextChannel().getName() + ") - " + BColor.RESET + " Adding role " + role.getName() + " to " + m.getUser().getName() + "(" + m.getId() + ")");
|
||||
guild.addRoleToMember(m, role).queue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package com.fpghoti.biscuit.logging;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
|
||||
public class BiscuitLog {
|
||||
|
||||
private final Logger console = LoggerFactory.getLogger("Biscuit");
|
||||
private final Logger file = LoggerFactory.getLogger("B-File");
|
||||
|
||||
public void debug(String msg) {
|
||||
console.debug("[" + BColor.MAGENTA_BOLD + "DEBUG" + BColor.RESET + "] " + BColor.MAGENTA + msg + BColor.RESET);
|
||||
if(!Main.isPlugin) {
|
||||
file.debug(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void error(String msg) {
|
||||
console.error("[" + BColor.RED_BOLD + "ERROR" + BColor.RESET + "] " + BColor.RED + msg + BColor.RESET);
|
||||
if(!Main.isPlugin) {
|
||||
file.error(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void info(String msg) {
|
||||
console.info(msg + BColor.RESET);
|
||||
if(!Main.isPlugin) {
|
||||
file.info(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void trace(String msg) {
|
||||
console.trace("[" + BColor.CYAN_BOLD + "TRACE" + BColor.RESET + "] " + BColor.CYAN + msg + BColor.RESET);
|
||||
if(!Main.isPlugin) {
|
||||
file.trace(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void warn(String msg) {
|
||||
console.warn("[" + BColor.YELLOW_BOLD + "WARN" + BColor.RESET + "] " + BColor.YELLOW + msg + BColor.RESET);
|
||||
if(!Main.isPlugin) {
|
||||
file.warn(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.fpghoti.biscuit.logging;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
|
||||
public class BiscuitLogger {
|
||||
|
||||
private final Logger console = LoggerFactory.getLogger("Biscuit");
|
||||
private final Logger file = LoggerFactory.getLogger("B-File");
|
||||
|
||||
public void debug(String msg) {
|
||||
console.debug(powerShellCompat("[" + BColor.MAGENTA_BOLD + "DEBUG" + BColor.RESET + "] " + BColor.MAGENTA + msg + BColor.RESET));
|
||||
if(!Main.isPlugin) {
|
||||
file.debug(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void error(String msg) {
|
||||
console.error(powerShellCompat("[" + BColor.RED_BOLD + "ERROR" + BColor.RESET + "] " + BColor.RED + msg + BColor.RESET));
|
||||
if(!Main.isPlugin) {
|
||||
file.error(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void info(String msg) {
|
||||
console.info(powerShellCompat(msg + BColor.RESET));
|
||||
if(!Main.isPlugin) {
|
||||
file.info(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void trace(String msg) {
|
||||
console.trace(powerShellCompat("[" + BColor.CYAN_BOLD + "TRACE" + BColor.RESET + "] " + BColor.CYAN + msg + BColor.RESET));
|
||||
if(!Main.isPlugin) {
|
||||
file.trace(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
public void warn(String msg) {
|
||||
console.warn(powerShellCompat("[" + BColor.YELLOW_BOLD + "WARN" + BColor.RESET + "] " + BColor.YELLOW + msg + BColor.RESET));
|
||||
if(!Main.isPlugin) {
|
||||
file.warn(BColor.clear(msg));
|
||||
}
|
||||
}
|
||||
|
||||
private String powerShellCompat(String s) {
|
||||
if(Main.getMainBiscuit() == null || Main.getMainBiscuit().getProperties() == null) {
|
||||
return s;
|
||||
}
|
||||
if(Main.getMainBiscuit().getProperties().isPowerShell()) {
|
||||
s = s.replace(BColor.MAGENTA + "", BColor.RED_BOLD + "");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,7 +7,7 @@ import org.pf4j.PluginWrapper;
|
|||
|
||||
import com.fpghoti.biscuit.Main;
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
import com.fpghoti.biscuit.logging.BiscuitLog;
|
||||
import com.fpghoti.biscuit.logging.BiscuitLogger;
|
||||
import com.github.cage.Cage;
|
||||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public abstract class BiscuitPlugin extends Plugin {
|
|||
return Main.getPlayerManager();
|
||||
}
|
||||
|
||||
public BiscuitLog getLogger() {
|
||||
public BiscuitLogger getLogger() {
|
||||
return Main.getLogger();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import com.fpghoti.biscuit.Main;
|
|||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
|
||||
import net.dv8tion.jda.api.entities.MessageEmbed;
|
||||
import net.dv8tion.jda.api.entities.PrivateChannel;
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;;
|
||||
|
||||
public class MessageText {
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ import com.fpghoti.biscuit.captcha.Captcha;
|
|||
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.MessageChannel;
|
||||
import net.dv8tion.jda.api.entities.User;
|
||||
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
|
||||
|
||||
public class CaptchaUser implements Iterable<PreUser>{
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.fpghoti.biscuit.biscuit.Biscuit;
|
|||
import com.fpghoti.biscuit.logging.BColor;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.emoji.Emoji;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
|
||||
public class ChatFilter {
|
||||
|
@ -36,7 +36,7 @@ public class ChatFilter {
|
|||
}
|
||||
|
||||
//Custom emote check
|
||||
for(Emote e : event.getMessage().getEmotes()) {
|
||||
for(Emoji e : event.getMessage().getMentions().getCustomEmojis()) {
|
||||
String name = e.getName();
|
||||
|
||||
for(String s : biscuit.getProperties().blockedCustomEmotes()) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.Random;
|
|||
|
||||
import com.fpghoti.biscuit.biscuit.Biscuit;
|
||||
|
||||
import net.dv8tion.jda.api.entities.TextChannel;
|
||||
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
|
||||
|
||||
public class Util {
|
||||
public static int randInt(int min, int max) {
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
<configuration>
|
||||
<property scope="context" name="COLORIZER_COLORS"
|
||||
value="boldred@,boldyellow@,boldcyan@,boldmagenta@,boldwhite@" />
|
||||
<conversionRule conversionWord="colorize"
|
||||
converterClass="org.tuxdude.logback.extensions.LogColorizer" />
|
||||
|
||||
<appender name="STDOUT"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%colorize([%date{MM/dd/yyyy HH:mm:ss}]) %msg%n</pattern>
|
||||
<pattern>[%date{MM/dd/yyyy HH:mm:ss}] %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
|
Loading…
Reference in New Issue