mirror of
https://github.com/Duke-Syndicate/duke-bot.git
synced 2025-09-10 04:38:13 +00:00
Duke
This commit is contained in:
commit
3be2585094
40
.gitignore
vendored
Normal file
40
.gitignore
vendored
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
token.txt
|
||||||
|
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
7
.idea/encodings.xml
generated
Normal file
7
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
15
.idea/misc.xml
generated
Normal file
15
.idea/misc.xml
generated
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="temurin-17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
25
pom.xml
Normal file
25
pom.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>hard.rock</groupId>
|
||||||
|
<artifactId>untitled</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- https://mvnrepository.com/artifact/net.dv8tion/JDA -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.dv8tion</groupId>
|
||||||
|
<artifactId>JDA</artifactId>
|
||||||
|
<version>5.0.0-beta.21</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
26
src/main/java/hard/rock/Main.java
Normal file
26
src/main/java/hard/rock/Main.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package hard.rock;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.JDABuilder;
|
||||||
|
import net.dv8tion.jda.api.entities.Activity;
|
||||||
|
import net.dv8tion.jda.api.requests.GatewayIntent;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
String token = new String(Main.class.getResourceAsStream("/token.txt").readAllBytes(), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
JDABuilder builder = JDABuilder.createDefault(token)
|
||||||
|
.addEventListeners(new ReadyListener(), new MessageListener());
|
||||||
|
|
||||||
|
//builder.setBulkDeleteSplittingEnabled(false);
|
||||||
|
builder.setActivity(Activity.watching("Duke Sex"));
|
||||||
|
builder.disableIntents(GatewayIntent.GUILD_PRESENCES, GatewayIntent.GUILD_MESSAGE_TYPING);
|
||||||
|
builder.enableIntents(GatewayIntent.MESSAGE_CONTENT);
|
||||||
|
builder.setLargeThreshold(50);
|
||||||
|
|
||||||
|
builder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
29
src/main/java/hard/rock/MessageListener.java
Normal file
29
src/main/java/hard/rock/MessageListener.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package hard.rock;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.entities.Message;
|
||||||
|
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
|
||||||
|
import net.dv8tion.jda.api.events.GenericEvent;
|
||||||
|
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||||
|
import net.dv8tion.jda.api.events.message.MessageUpdateEvent;
|
||||||
|
import net.dv8tion.jda.api.hooks.EventListener;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class MessageListener implements EventListener {
|
||||||
|
@Override
|
||||||
|
public void onEvent(@NotNull GenericEvent event) {
|
||||||
|
if (event instanceof MessageReceivedEvent mevent) {
|
||||||
|
handleMessageEvent(mevent.getMessage(), mevent.getChannel());
|
||||||
|
} else if (event instanceof MessageUpdateEvent muevent) {
|
||||||
|
handleMessageEvent(muevent.getMessage(), muevent.getChannel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleMessageEvent(Message message, MessageChannelUnion channel) {
|
||||||
|
if(channel.getIdLong() == 1217221104289058896L) {
|
||||||
|
String mCL = message.getContentRaw().toLowerCase();
|
||||||
|
if(!(mCL.equals("he's so talented") || mCL.equals("he's so talented.") || mCL.equals("hes so talented") || mCL.equals("hes so talented."))) {
|
||||||
|
message.delete().reason("Ruining the fun").queue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
src/main/java/hard/rock/ReadyListener.java
Normal file
14
src/main/java/hard/rock/ReadyListener.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package hard.rock;
|
||||||
|
|
||||||
|
import net.dv8tion.jda.api.events.GenericEvent;
|
||||||
|
import net.dv8tion.jda.api.events.session.ReadyEvent;
|
||||||
|
import net.dv8tion.jda.api.hooks.EventListener;
|
||||||
|
|
||||||
|
public class ReadyListener implements EventListener {
|
||||||
|
@Override
|
||||||
|
public void onEvent(GenericEvent event) {
|
||||||
|
if (event instanceof ReadyEvent) {
|
||||||
|
System.out.println("Duke is rizzing");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
src/main/resources/.gitignore
vendored
Normal file
1
src/main/resources/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
token.txt
|
Loading…
x
Reference in New Issue
Block a user