Skip to content

Instantly share code, notes, and snippets.

View itsmefox's full-sized avatar
🦊
If you can be a Fox

itsmefox itsmefox

🦊
If you can be a Fox
View GitHub Profile
@itsmefox
itsmefox / PingCommand.kt
Created November 24, 2022 16:05
Create your Discord Bot with aluna-spring-boot-starter - PingCommand
@Interaction
class PingCommand : DiscordCommand("ping", "Send a ping command") {
override fun execute(event: SlashCommandInteractionEvent) {
//Reply to the user
val startTime = System.currentTimeMillis()
event.reply("Ping ...").setEphemeral(true).queue {
it.editOriginal("Pong: ${System.currentTimeMillis() - startTime}ms").queue()
}
}
@itsmefox
itsmefox / BotReadyListener.kt
Last active November 25, 2022 10:29
Create your Discord Bot with aluna-spring-boot-starter - BotReadyListener
@Component
class BotReadyListener : ApplicationListener<DiscordFirstShardReadyEvent> {
override fun onApplicationEvent(event: DiscordFirstShardReadyEvent) {
//Set the status of the bot as soon as possible
event.shardManager.setPresence(OnlineStatus.ONLINE, Activity.playing("I'm Ready"))
}
}
@itsmefox
itsmefox / psql_useful_stat_queries.sql
Created December 12, 2022 14:25 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables