Skip to content

Instantly share code, notes, and snippets.

View SamOphis's full-sized avatar
🌹

Sam (luau) SamOphis

🌹
  • West Midlands, United Kingdom
  • X @luauOW
View GitHub Profile
@SamOphis
SamOphis / config.toml
Created February 23, 2019 15:37
Kunou v2 Configuration File (in TOML). Prone to changes at any moment without notice.
[kunou]
token = "bot token"
[kunou.presences]
type = "LISTENING"
messages = ["blah", "blah 2"]
[kunou.commands]
default_prefix = "k->"
package = "com.github.samophis.kunou.commands.list"
@SamOphis
SamOphis / basalt.yml
Last active August 15, 2018 02:31
Documented Example of a Basalt Configuration File.
basalt:
socket:
host: 0.0.0.0 # The address to bind Basalt to (0.0.0.0 = all addresses)
port: 5555 # The port to run Basalt's WebSocket Server on.
password: youshallnotpass # The password needed to authenticate a connection to Basalt (can be optional).
bufferDurationMs: 400 # JDA-NAS Buffer Duration (400ms is fine).
playlistPageLimit: 10 # The maximum amount of songs (x100) to load in a playlist.
loadChunkSize: 25 # The amount of loaded tracks to respond with in each LOAD_TRACK_CHUNK event.
statsInterval: 30 # Interval to send stats at (cannot be lower than 5).
@SamOphis
SamOphis / CommandContext.kt
Created August 1, 2018 02:55
Basic Kotlin code example with very helpful comments.
package kunou.commands
import kunou.startup.Kunou
import net.dv8tion.jda.core.entities.Member
import net.dv8tion.jda.core.entities.Message
import org.slf4j.LoggerFactory
import java.lang.NumberFormatException
/* This is an example of primary constructors in Kotlin. Note the use of the "val" keyword, which declares
an immutable property/field/variable. Notice how it can be used in constructors to declare properties.
@SamOphis
SamOphis / EventLimiterImpl.java
Created May 19, 2018 10:03
A production-ready example on how to safely rate-limit outgoing events to Discord's Real-Time Gateway.
package samophis.kunou.main.entities.gateway.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import samophis.kunou.main.entities.gateway.EventLimiter;
import javax.annotation.Nonnull;
import java.util.Objects;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;