This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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")) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ _ ____ _ _ ____ _ | |
/ \ | |_ _ _ __ __ _ | _ \(_)___ ___ ___ _ __ __| | | __ ) ___ | |_ | |
/ _ \ | | | | | '_ \ / _` | | | | | / __|/ __/ _ \| '__/ _` | | _ \ / _ \| __| | |
/ ___ \| | |_| | | | | (_| | | |_| | \__ \ (_| (_) | | | (_| | | |_) | (_) | |_ | |
/_/ \_\_|\__,_|_| |_|\__,_| |____/|_|___/\___\___/|_| \__,_| |____/ \___/ \__| | |
Aluna: 0.0.32_5.0.0-alpha.22-SNAPSHOT | |
Spring-Boot: 2.7.0 | |
JDA: 5.0.0-alpha.22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aluna: | |
discord: | |
application-id: | |
token: | |
logging: | |
level: | |
io.viascom.discord.bot.aluna.AlunaAutoConfiguration: DEBUG | |
io.viascom.discord.bot.aluna.SlashCommandInteractionInitializer: DEBUG | |
io.viascom.discord.bot.aluna.ListenerRegistration: DEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootApplication | |
open class BotApplication { | |
companion object { | |
@JvmStatic | |
fun main(args: Array<String>) { | |
runApplication<BotApplication>(*args) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PingCommand extends ListenerAdapter { | |
private Logger logger = LoggerFactory.getLogger(this.getClass()); | |
//This gets called when a slash command gets used. | |
@Override | |
public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) { | |
//Check if this is our /ping command | |
if (event.getName().equals("ping")) { | |
logger.info("Command /ping got used"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Application { | |
public static void main(String[] args) throws LoginException { | |
String token = ""; | |
//Create a new JDA instance | |
JDA jda = JDABuilder.createDefault(token) | |
.addEventListeners(new PingCommand()) //Register our /ping Command | |
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Application { | |
public static void main(String[] args) throws LoginException { | |
String token = ""; | |
//Create a new JDA instance | |
JDA jda = JDABuilder.createDefault(token).build(); | |
//Set the activity to "I'm Ready" | |
jda.getPresence().setActivity(Activity.playing("I'm Ready")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PingCommand : ListenerAdapter() { | |
private val logger: Logger = LoggerFactory.getLogger(javaClass) | |
//This gets called when a slash command gets used. | |
override fun onSlashCommandInteraction(event: SlashCommandInteractionEvent) { | |
//Check if this is our /ping command | |
if (event.name == "ping") { | |
logger.info("Command /ping got used") |
NewerOlder