mirror of
https://github.com/HMCore/Orbot.git
synced 2025-12-12 22:06:23 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dfe3f1bd7 |
34
.idea/workspace.xml
generated
34
.idea/workspace.xml
generated
@@ -2,7 +2,15 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment="">
|
<list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/OwnerCli.kt" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" 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/Channels.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Channels.kt" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/Cli.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/AdminCli.kt" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/DataIO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/DataIO.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/web/SiteWatcher.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/de/wulkanat/web/SiteWatcher.kt" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -122,7 +130,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="Kotlin.MainKt">
|
<component name="RunManager" selected="Gradle.HytaleUpdateBot [fatJar]">
|
||||||
<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" />
|
||||||
@@ -199,8 +207,8 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
<item itemvalue="Kotlin.MainKt" />
|
|
||||||
<item itemvalue="Gradle.HytaleUpdateBot [fatJar]" />
|
<item itemvalue="Gradle.HytaleUpdateBot [fatJar]" />
|
||||||
|
<item itemvalue="Kotlin.MainKt" />
|
||||||
<item itemvalue="Gradle.HytaleUpdateBot [build]" />
|
<item itemvalue="Gradle.HytaleUpdateBot [build]" />
|
||||||
<item itemvalue="Gradle.HytaleUpdateBot [clean]" />
|
<item itemvalue="Gradle.HytaleUpdateBot [clean]" />
|
||||||
<item itemvalue="JAR Application.HytaleUpdateBot-all-1.0-SNAPSHOT.jar" />
|
<item itemvalue="JAR Application.HytaleUpdateBot-all-1.0-SNAPSHOT.jar" />
|
||||||
@@ -280,26 +288,26 @@
|
|||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="740" y="238" key="FileChooserDialogImpl/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597605616287" />
|
<state x="740" y="238" key="FileChooserDialogImpl/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597605616287" />
|
||||||
<state width="1876" height="161" key="GridCell.Tab.0.bottom" timestamp="1597739482072">
|
<state width="1876" height="161" key="GridCell.Tab.0.bottom" timestamp="1597438612599">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1006" height="588" key="GridCell.Tab.0.bottom/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@-1050.105.1050.1640" timestamp="1597351329412" />
|
<state width="1006" height="588" key="GridCell.Tab.0.bottom/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@-1050.105.1050.1640" timestamp="1597351329412" />
|
||||||
<state width="1876" height="161" key="GridCell.Tab.0.bottom/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597739482072" />
|
<state width="1876" height="161" key="GridCell.Tab.0.bottom/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597438612599" />
|
||||||
<state width="1876" height="161" key="GridCell.Tab.0.center" timestamp="1597739482072">
|
<state width="1876" height="161" key="GridCell.Tab.0.center" timestamp="1597438612598">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1006" height="588" key="GridCell.Tab.0.center/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@-1050.105.1050.1640" timestamp="1597351329411" />
|
<state width="1006" height="588" key="GridCell.Tab.0.center/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@-1050.105.1050.1640" timestamp="1597351329411" />
|
||||||
<state width="1876" height="161" key="GridCell.Tab.0.center/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597739482072" />
|
<state width="1876" height="161" key="GridCell.Tab.0.center/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597438612598" />
|
||||||
<state width="1876" height="161" key="GridCell.Tab.0.left" timestamp="1597739482072">
|
<state width="1876" height="161" key="GridCell.Tab.0.left" timestamp="1597438612597">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1006" height="588" key="GridCell.Tab.0.left/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@-1050.105.1050.1640" timestamp="1597351329411" />
|
<state width="1006" height="588" key="GridCell.Tab.0.left/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@-1050.105.1050.1640" timestamp="1597351329411" />
|
||||||
<state width="1876" height="161" key="GridCell.Tab.0.left/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597739482072" />
|
<state width="1876" height="161" key="GridCell.Tab.0.left/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597438612597" />
|
||||||
<state width="1876" height="161" key="GridCell.Tab.0.right" timestamp="1597739482072">
|
<state width="1876" height="161" key="GridCell.Tab.0.right" timestamp="1597438612599">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1006" height="588" key="GridCell.Tab.0.right/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@-1050.105.1050.1640" timestamp="1597351329411" />
|
<state width="1006" height="588" key="GridCell.Tab.0.right/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@-1050.105.1050.1640" timestamp="1597351329411" />
|
||||||
<state width="1876" height="161" key="GridCell.Tab.0.right/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597739482072" />
|
<state width="1876" height="161" key="GridCell.Tab.0.right/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597438612599" />
|
||||||
<state width="1006" height="588" key="GridCell.Tab.1.bottom" timestamp="1597366506508">
|
<state width="1006" height="588" key="GridCell.Tab.1.bottom" timestamp="1597366506508">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
@@ -341,10 +349,10 @@
|
|||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="616" y="240" key="run.anything.popup/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597325088886" />
|
<state x="616" y="240" key="run.anything.popup/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597325088886" />
|
||||||
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup" timestamp="1597702900013">
|
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup" timestamp="1597363843473">
|
||||||
<screen x="0" y="0" width="1920" height="1040" />
|
<screen x="0" y="0" width="1920" height="1040" />
|
||||||
</state>
|
</state>
|
||||||
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597702900013" />
|
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup/0.0.1920.1040/1920.-213.2560.1400/-1050.105.1050.1640@0.0.1920.1040" timestamp="1597363843473" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<watches-manager>
|
<watches-manager>
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -16,8 +16,7 @@ Add your Discord ID (not name), Bot token, and update frequency to the `admin.js
|
|||||||
{
|
{
|
||||||
"adminId": 12345678910,
|
"adminId": 12345678910,
|
||||||
"token": "AOGH@(AKnjsfjiJijaig3ijgG92jaij",
|
"token": "AOGH@(AKnjsfjiJijaig3ijgG92jaij",
|
||||||
"updateMs": 30000,
|
"updateMs":30000
|
||||||
"watchingMessage": "for new Blogposts"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
* add your servers to `servers.json`
|
* add your servers to `servers.json`
|
||||||
@@ -26,20 +25,17 @@ Add your Discord ID (not name), Bot token, and update frequency to the `admin.js
|
|||||||
{
|
{
|
||||||
"id": 15050067772322222,
|
"id": 15050067772322222,
|
||||||
"mentionedRole": "everyone",
|
"mentionedRole": "everyone",
|
||||||
"autoPublish": true,
|
"autoPublish":true
|
||||||
"message": null
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 74050067772325222,
|
"id": 74050067772325222,
|
||||||
"mentionedRole": null,
|
"mentionedRole": null,
|
||||||
"autoPublish":false,
|
"autoPublish":false
|
||||||
"message": null
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 74050067772325222,
|
"id": 74050067772325222,
|
||||||
"mentionedRole": "74036067771625222",
|
"mentionedRole": "74036067771625222",
|
||||||
"autoPublish":false,
|
"autoPublish":false
|
||||||
"message": null
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'de.wulkanat'
|
group 'de.wulkanat'
|
||||||
version '1.3'
|
version '1.1'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ object Admin {
|
|||||||
val userId: Long
|
val userId: Long
|
||||||
val token: String
|
val token: String
|
||||||
val updateMs: Long
|
val updateMs: Long
|
||||||
val message: String
|
|
||||||
|
|
||||||
var testModeEnabled: Boolean = false
|
var testModeEnabled: Boolean = false
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -37,7 +36,6 @@ object Admin {
|
|||||||
userId = admin.adminId
|
userId = admin.adminId
|
||||||
token = admin.token
|
token = admin.token
|
||||||
updateMs = admin.updateMs
|
updateMs = admin.updateMs
|
||||||
message = admin.watchingMessage
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var jda: JDA? = null
|
var jda: JDA? = null
|
||||||
@@ -73,19 +71,12 @@ object Admin {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun error(msg: String, error: String, author: User? = null) {
|
fun error(msg: String, error: String) {
|
||||||
sendDevMessage(
|
sendDevMessage(
|
||||||
EmbedBuilder()
|
EmbedBuilder()
|
||||||
.setTitle(msg)
|
.setTitle(msg)
|
||||||
.setDescription(error)
|
.setDescription(error)
|
||||||
.setColor(Color.RED)
|
.setColor(Color.RED)
|
||||||
.run {
|
|
||||||
if (author == null) {
|
|
||||||
this
|
|
||||||
} else {
|
|
||||||
this.setAuthor(author.asTag, author.avatarUrl, author.avatarUrl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.build()
|
.build()
|
||||||
, "$msg\n\n${error}"
|
, "$msg\n\n${error}"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import net.dv8tion.jda.api.JDA
|
|||||||
import net.dv8tion.jda.api.Permission
|
import net.dv8tion.jda.api.Permission
|
||||||
import net.dv8tion.jda.api.entities.MessageEmbed
|
import net.dv8tion.jda.api.entities.MessageEmbed
|
||||||
import net.dv8tion.jda.api.entities.TextChannel
|
import net.dv8tion.jda.api.entities.TextChannel
|
||||||
import net.dv8tion.jda.api.exceptions.ErrorResponseException
|
|
||||||
|
|
||||||
object Channels {
|
object Channels {
|
||||||
var jda: JDA? = null
|
var jda: JDA? = null
|
||||||
@@ -24,35 +23,20 @@ object Channels {
|
|||||||
return
|
return
|
||||||
|
|
||||||
for (channel_pair in channels) {
|
for (channel_pair in channels) {
|
||||||
try {
|
val channel = jda!!.getTextChannelById(channel_pair.id) ?: continue
|
||||||
val channel = jda!!.getTextChannelById(channel_pair.id) ?: continue
|
|
||||||
val customMessage = channel_pair.message?.message ?: ""
|
|
||||||
|
|
||||||
if (channel_pair.mentionedRole != null) {
|
if (channel_pair.mentionedRole != null) {
|
||||||
val message = if (channel_pair.mentionedRole == "everyone") {
|
val message = if (channel_pair.mentionedRole == "everyone") {
|
||||||
"@everyone $customMessage"
|
"New Blogpost @everyone"
|
||||||
} else {
|
} else {
|
||||||
"<@&${channel_pair.mentionedRole}> $customMessage"
|
"New Blogpost <@&${channel_pair.mentionedRole}>"
|
||||||
}
|
|
||||||
channel.sendMessage(message).queue {
|
|
||||||
if (channel_pair.message?.pushAnnouncement == true) {
|
|
||||||
it.crosspost().queue()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (channel_pair.message != null) {
|
|
||||||
channel.sendMessage(customMessage).queue {
|
|
||||||
if (channel_pair.message?.pushAnnouncement == true) {
|
|
||||||
it.crosspost().queue()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
channel.sendMessage(messageEmbed).queue {
|
channel.sendMessage(message).queue()
|
||||||
if (channel_pair.autoPublish) {
|
}
|
||||||
it.crosspost().queue()
|
channel.sendMessage(messageEmbed).queue {
|
||||||
}
|
if (channel_pair.autoPublish) {
|
||||||
|
it.crosspost().queue()
|
||||||
}
|
}
|
||||||
} catch (e: ErrorResponseException) {
|
|
||||||
Admin.error("Error in server", e.message ?: e.localizedMessage)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +70,7 @@ object Channels {
|
|||||||
if (jda == null)
|
if (jda == null)
|
||||||
return listOf()
|
return listOf()
|
||||||
|
|
||||||
return channels.filter { server == null || (jda!!.getTextChannelById(it.id)?.guild?.idLong == server) }.map {
|
return channels.filter { server != null && (jda!!.getTextChannelById(it.id)?.guild?.idLong == server) }.map {
|
||||||
val channel = jda!!.getTextChannelById(it.id)
|
val channel = jda!!.getTextChannelById(it.id)
|
||||||
if (channel == null) {
|
if (channel == null) {
|
||||||
Admin.warning("Channel ${it.id} is no longer active!")
|
Admin.warning("Channel ${it.id} is no longer active!")
|
||||||
@@ -98,13 +82,7 @@ object Channels {
|
|||||||
"everyone" -> " @everyone"
|
"everyone" -> " @everyone"
|
||||||
else -> " @${channel.guild.getRoleById(it.mentionedRole ?: "")?.name}"
|
else -> " @${channel.guild.getRoleById(it.mentionedRole ?: "")?.name}"
|
||||||
}
|
}
|
||||||
val publish = if (it.autoPublish) " (publish)" else ""
|
"**${channel.guild.name}**\n#${channel.name}${role}"
|
||||||
"**${channel.guild.name}**\n#${channel.name}${role}${publish}${if (it.message == null) {
|
|
||||||
""
|
|
||||||
} else {
|
|
||||||
"\n*${it.message!!.message}*${if (it.message!!.pushAnnouncement) " (publish)" else ""}"
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,22 +7,14 @@ import java.io.File
|
|||||||
data class DiscordChannel(
|
data class DiscordChannel(
|
||||||
val id: Long,
|
val id: Long,
|
||||||
var mentionedRole: String? = null,
|
var mentionedRole: String? = null,
|
||||||
var autoPublish: Boolean = false,
|
var autoPublish: Boolean = false
|
||||||
var message: CustomMessage? = null
|
|
||||||
)
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class CustomMessage(
|
|
||||||
var message: String,
|
|
||||||
var pushAnnouncement: Boolean = false
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AdminFile(
|
data class AdminFile(
|
||||||
val adminId: Long,
|
val adminId: Long,
|
||||||
val token: String,
|
val token: String,
|
||||||
val updateMs: Long,
|
val updateMs: Long
|
||||||
val watchingMessage: String
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val SERVERS_FILE = File("servers.json")
|
val SERVERS_FILE = File("servers.json")
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ fun main() {
|
|||||||
val builder = JDABuilder.createLight(
|
val builder = JDABuilder.createLight(
|
||||||
Admin.token,
|
Admin.token,
|
||||||
GatewayIntent.GUILD_MESSAGES, GatewayIntent.DIRECT_MESSAGES)
|
GatewayIntent.GUILD_MESSAGES, GatewayIntent.DIRECT_MESSAGES)
|
||||||
.setActivity(Activity.watching(Admin.message))
|
.setActivity(Activity.watching("for new Blogposts"))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
builder.addEventListener(AdminCli())
|
builder.addEventListener(AdminCli())
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ class OwnerCli : ListenerAdapter() {
|
|||||||
result.autoPublish = command[1] == "on"
|
result.autoPublish = command[1] == "on"
|
||||||
Channels.saveChannels()
|
Channels.saveChannels()
|
||||||
|
|
||||||
event.message.channel.sendMessage("Auto publish is now ${command[1]}").queue()
|
event.message.channel.sendMessage("Auto publish is now on").queue()
|
||||||
} else {
|
} else {
|
||||||
event.message.channel.sendMessage("Usage: `${prefix}publish [on|off]`")
|
event.message.channel.sendMessage("Usage: `${prefix}publish [on|off]`")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
event.message.channel.sendMessage("Channel not registered.").queue()
|
event.message.channel.sendMessage("Added.").queue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"ping" -> {
|
"ping" -> {
|
||||||
@@ -84,80 +84,21 @@ class OwnerCli : ListenerAdapter() {
|
|||||||
event.message.channel.sendMessage("Channel is not registered.").queue()
|
event.message.channel.sendMessage("Channel is not registered.").queue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"setMessage" -> {
|
|
||||||
val result = Channels.channels.find { it.id == channelId }
|
|
||||||
if (result != null) {
|
|
||||||
if (command.size > 1) {
|
|
||||||
val message = event.message.contentRaw.removePrefix("${prefix}setMessage").trim()
|
|
||||||
result.message = CustomMessage(message)
|
|
||||||
Channels.saveChannels()
|
|
||||||
event.message.channel.sendMessage("Set `$message` as message.").queue()
|
|
||||||
} else {
|
|
||||||
event.message.channel.sendMessage("Usage: `${prefix}setMessage [message]`")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.message.channel.sendMessage("Channel is not registered.").queue()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"resetMessage" -> {
|
|
||||||
val result = Channels.channels.find { it.id == channelId }
|
|
||||||
if (result != null) {
|
|
||||||
result.message = null
|
|
||||||
Channels.saveChannels()
|
|
||||||
event.message.channel.sendMessage("Reset to no message.").queue()
|
|
||||||
} else {
|
|
||||||
event.message.channel.sendMessage("Channel is not registered.").queue()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"publishMessage" -> {
|
|
||||||
val result = Channels.channels.find { it.id == channelId }
|
|
||||||
if (result != null) {
|
|
||||||
if (result.message != null) {
|
|
||||||
if (command.size > 1 && listOf("on", "off").contains(command[1])) {
|
|
||||||
result.message?.pushAnnouncement = command[1] == "on"
|
|
||||||
Channels.saveChannels()
|
|
||||||
|
|
||||||
event.message.channel.sendMessage("Auto publish (message) is now ${command[1]}").queue()
|
|
||||||
} else {
|
|
||||||
event.message.channel.sendMessage("Usage: `${prefix}publishMessage [on|off]`")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.message.channel.sendMessage("Channel has no custom message.").queue()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.message.channel.sendMessage("Channel not registered.").queue()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"info" -> {
|
"info" -> {
|
||||||
event.message.channel.sendMessage(
|
event.message.channel.sendMessage(EmbedBuilder()
|
||||||
EmbedBuilder()
|
.setTitle("Server overview")
|
||||||
.setTitle("Server overview")
|
.setColor(Color.GREEN)
|
||||||
.setColor(Color.GREEN)
|
.setDescription(Channels.getServerNames(event.message.guild.idLong).joinToString("\n"))
|
||||||
.setDescription(Channels.getServerNames(event.message.guild.idLong).joinToString("\n"))
|
.setAuthor(Admin.admin?.name, Admin.admin?.avatarUrl, Admin.admin?.avatarUrl)
|
||||||
.setAuthor(Admin.admin?.name, Admin.admin?.avatarUrl, Admin.admin?.avatarUrl)
|
.build()).queue()
|
||||||
.build()
|
|
||||||
).queue()
|
|
||||||
}
|
|
||||||
"report" -> {
|
|
||||||
val errorReport = event.message.contentRaw.removePrefix("${prefix}report")
|
|
||||||
Admin.error(event.message.guild.name, errorReport, event.author)
|
|
||||||
event.message.channel.sendMessage(
|
|
||||||
EmbedBuilder()
|
|
||||||
.setTitle("Error Report Received")
|
|
||||||
.setColor(Color.RED)
|
|
||||||
.setDescription(errorReport)
|
|
||||||
.setAuthor(Admin.admin?.name, Admin.admin?.avatarUrl, Admin.admin?.avatarUrl)
|
|
||||||
.build()
|
|
||||||
).queue()
|
|
||||||
}
|
}
|
||||||
"help" -> {
|
"help" -> {
|
||||||
event.message.channel.sendMessage(
|
event.message.channel.sendMessage(EmbedBuilder()
|
||||||
EmbedBuilder()
|
.setTitle("Help")
|
||||||
.setTitle("Help")
|
.setColor(Color.YELLOW)
|
||||||
.setColor(Color.YELLOW)
|
.setAuthor(Admin.admin?.name, Admin.admin?.avatarUrl, Admin.admin?.avatarUrl)
|
||||||
.setAuthor(Admin.admin?.name, Admin.admin?.avatarUrl, Admin.admin?.avatarUrl)
|
.setDescription(
|
||||||
.setDescription(
|
"""
|
||||||
"""
|
|
||||||
**${prefix}add**
|
**${prefix}add**
|
||||||
Add this channel to the notified list
|
Add this channel to the notified list
|
||||||
**${prefix}remove**
|
**${prefix}remove**
|
||||||
@@ -166,20 +107,12 @@ class OwnerCli : ListenerAdapter() {
|
|||||||
[Community|Partner|Verified only] Auto publish the message if in an announcement channel
|
[Community|Partner|Verified only] Auto publish the message if in an announcement channel
|
||||||
**${prefix}ping [none|everyone|roleName]**
|
**${prefix}ping [none|everyone|roleName]**
|
||||||
What role to ping
|
What role to ping
|
||||||
**${prefix}setMessage [message]**
|
|
||||||
Set a custom message to show
|
|
||||||
**${prefix}resetMessage**
|
|
||||||
Reset the message
|
|
||||||
**${prefix}info**
|
**${prefix}info**
|
||||||
Show an overview about all channels registered on this server
|
Show an overview about all channels registered on this server
|
||||||
**${prefix}report**
|
|
||||||
Report an issue to the Bot Admin (this will share your user name so they can contact you)
|
|
||||||
**${prefix}help**
|
**${prefix}help**
|
||||||
Show this message
|
Show this message
|
||||||
""".trimIndent()
|
""".trimIndent())
|
||||||
)
|
.build()).queue()
|
||||||
.build()
|
|
||||||
).queue()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user