Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Wip
  • Loading branch information
duncte123 committed Jul 11, 2021
commit 7f0a4407bd280bcc211af307b6ee4548c3178785
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {

implementation(group = "ch.qos.logback", name = "logback-classic", version = "1.2.3")

implementation(group = "com.sparkjava", name = "spark-core", version = "2.9.2")
implementation(group = "com.sparkjava", name = "spark-core", version = "2.9.3")
implementation(group = "org.apache.velocity", name = "velocity-engine-core", version = "2.2")

implementation(group = "com.github.ben-manes.caffeine", name = "caffeine", version = "2.8.5")
Expand Down
9 changes: 3 additions & 6 deletions src/main/kotlin/com/dunctebot/dashboard/WebServer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,6 @@ class WebServer {
return@get OtherAPi.uptimeRobot()
}

// keep?
get("/commands.json") { _, _ ->
"TODO: setup websocket to bot"
}

post("/update-data") { request, _ ->
return@post DataController.updateData(request)
}
Expand Down Expand Up @@ -265,7 +260,9 @@ class WebServer {
val tcs = guild.channels
.ofType(TextChannel::class.java)
.filter {
println("Channel $it")
it.getEffectivePermissions(selfId).map { p ->
println("Permissions $p")
p.containsAll(PermissionSet.of(
Permission.SEND_MESSAGES, Permission.VIEW_CHANNEL /* read messages */
))
Expand All @@ -274,7 +271,7 @@ class WebServer {
.collectList()
.block()!!

println(tcs)
println("channels $tcs")

val goodRoles = guild.roles
.filter { !it.managed() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ object DashboardController {

if (ses.attribute<String?>(USER_ID) == null || ses.attribute<String?>(SESSION_ID) == null) {
request.session().attribute(OLD_PAGE, request.pathInfo())
return response.redirect("/")
response.redirect("/")

throw Spark.halt()
}

val guild = request.fetchGuild() ?: throw haltDiscordError(DiscordError.NO_GUILD, request.guildId!!)
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/views/dashboard/includes/basic/autoRole.vm
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<select id="autoRoleRole" name="autoRoleRole">
<option value="" selected disabled>Select a role</option>
#foreach($role in $goodRoles)
#if($settings.getAutoroleRole() == $role.getIdLong())
<option value="$role.getIdLong()" selected>@$role.getName()</option>
#if($settings.getAutoroleRole() == $role.id().asLong())
<option value="$role.id().asLong()" selected>@$role.name()</option>
#else
<option value="$role.getIdLong()">@$role.getName()</option>
<option value="$role.id().asLong()">@$role.name()</option>
#end
#end
<option value="">Disable</option>
Expand Down