twitter gods dont cancel me pls

This commit is contained in:
UnrealValentin
2021-05-28 20:01:13 +02:00
parent 77f5733144
commit 7b29417678
5 changed files with 25 additions and 16 deletions

16
.idea/workspace.xml generated
View File

@@ -4,8 +4,10 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment="Update Json Serialization"> <list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Channels.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Channels.kt" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Admin.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Admin.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/AdminCli.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/AdminCli.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Main.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Main.kt" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Main.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Main.kt" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
@@ -90,7 +92,7 @@
<recent name="E:\Projects\Kotlin_Proj\HytaleUpdateBot\src\main\kotlin\de\wulkanat" /> <recent name="E:\Projects\Kotlin_Proj\HytaleUpdateBot\src\main\kotlin\de\wulkanat" />
</key> </key>
</component> </component>
<component name="RunManager" selected="Gradle.HytaleUpdateBot [build]"> <component name="RunManager" selected="Kotlin.Main">
<configuration name="HytaleUpdateBot [build]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true"> <configuration name="HytaleUpdateBot [build]" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings> <ExternalSystemSettings>
<option name="executionName" /> <option name="executionName" />
@@ -158,8 +160,8 @@
<option name="JAR_PATH" value="$PROJECT_DIR$/build/libs/HytaleUpdateBot-all-1.0-SNAPSHOT.jar" /> <option name="JAR_PATH" value="$PROJECT_DIR$/build/libs/HytaleUpdateBot-all-1.0-SNAPSHOT.jar" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
<configuration name="MainKt" type="JetRunConfigurationType" temporary="true" nameIsGenerated="true"> <configuration name="Main" type="JetRunConfigurationType" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="de.wulkanat.MainKt" /> <option name="MAIN_CLASS_NAME" value="de.wulkanat.Main" />
<module name="HytaleUpdateBot.main" /> <module name="HytaleUpdateBot.main" />
<method v="2"> <method v="2">
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
@@ -167,6 +169,7 @@
</configuration> </configuration>
<recent_temporary> <recent_temporary>
<list> <list>
<item itemvalue="Kotlin.Main" />
<item itemvalue="Gradle.HytaleUpdateBot [fatJar]" /> <item itemvalue="Gradle.HytaleUpdateBot [fatJar]" />
<item itemvalue="Gradle.HytaleUpdateBot [build]" /> <item itemvalue="Gradle.HytaleUpdateBot [build]" />
<item itemvalue="Gradle.HytaleUpdateBot [clean]" /> <item itemvalue="Gradle.HytaleUpdateBot [clean]" />
@@ -259,4 +262,7 @@
</configuration> </configuration>
</watches-manager> </watches-manager>
</component> </component>
<component name="se.expertsystem.intellij.aop.aspectj.AspectJProjectComponent">
<setting name="isActivated" value="false" />
</component>
</project> </project>

View File

@@ -36,7 +36,7 @@ public class TwitterJob implements Job {
if(!lastTweetID.equalsIgnoreCase(tweetID)) { if(!lastTweetID.equalsIgnoreCase(tweetID)) {
lastTweetID = tweetID; lastTweetID = tweetID;
Channels.INSTANCE.sentToAll(new MessageBuilder().append(" You got mail! <:blobmail:817758108503769130> https://twitter.com/Hytale/status/").append(tweetID).build()); Channels.INSTANCE.sentToAll(new MessageBuilder().append("https://twitter.com/Hytale/status/").append(tweetID).build());
} }

View File

@@ -20,7 +20,7 @@ object Admin {
fun connectToUser() { fun connectToUser() {
Main.jdas.forEach { Main.jdas.forEach {
admin ?: return; if(admin != null) return@forEach
admin = it.retrieveUserById(userId).complete() admin = it.retrieveUserById(userId).complete()
} }
if (admin == null) { if (admin == null) {
@@ -122,6 +122,8 @@ object Admin {
} }
fun sendDevMessage(messageEmbed: MessageEmbed, fallback: String) { fun sendDevMessage(messageEmbed: MessageEmbed, fallback: String) {
kotlin.io.println(admin!!.id)
val devChannel = admin?.openPrivateChannel() ?: kotlin.run { val devChannel = admin?.openPrivateChannel() ?: kotlin.run {
kotlin.io.println(fallback) kotlin.io.println(fallback)
return return

View File

@@ -5,6 +5,7 @@ import net.dv8tion.jda.api.hooks.ListenerAdapter
import de.wulkanat.web.SiteWatcher import de.wulkanat.web.SiteWatcher
import net.dv8tion.jda.api.EmbedBuilder import net.dv8tion.jda.api.EmbedBuilder
import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent
import org.hmcore.TwitterJob
import java.awt.Color import java.awt.Color
import kotlin.system.exitProcess import kotlin.system.exitProcess
@@ -32,6 +33,8 @@ class AdminCli : ListenerAdapter() {
description = "Lorem Ipsum" description = "Lorem Ipsum"
) )
TwitterJob.lastTweetID = "poggers"
Admin.println("Posting on next update cycle.") Admin.println("Posting on next update cycle.")
} }
"info" -> { "info" -> {

View File

@@ -35,22 +35,20 @@ object Main {
for (i in 0 until 6) { for (i in 0 until 6) {
try { try {
jdas.add( var jda = builder.useSharding(i, 6)
builder.useSharding(i, 6)
.build() .build()
jda.addEventListener(AdminCli())
jda.addEventListener(ErrorHandler())
jda.addEventListener(OwnerCli())
jda.awaitReady()
jdas.add(
jda
) )
} catch (loginException: LoginException) { } catch (loginException: LoginException) {
println("!!! Shard $i could not login !!!") println("!!! Shard $i could not login !!!")
} }
} }
val jda = builder.build()
jda.addEventListener(AdminCli())
jda.addEventListener(ErrorHandler())
jda.addEventListener(OwnerCli())
jda.awaitReady()
Admin.connectToUser() Admin.connectToUser()
Admin.info() Admin.info()