Skip to content

Instantly share code, notes, and snippets.

Luckshya Luckshya

  • India
Block or report user

Report or block Luckshya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Luckshya
Luckshya / example.nut
Last active May 15, 2020
Discord message handler
View example.nut
// Table to hold our Discord CSessions
sessions <- {};
// Wrapper class to manage our session
class CDiscord
{
session = null;
connID = null;
channels = null;
@Luckshya
Luckshya / Example.nut
Created Mar 10, 2019
Example discord code for official squirrel plugin (sleepy-discord)
View Example.nut
//open connection to discord
discordConn <- Discord_Open("token here");
//event onDiscord_Ready indicating that the bot has connected successfully
function onDiscord_Ready(discordHandle) {
//retrieve our connection ID
local connID = Discord_ConnID(discordHandle);
print("Discord bot at ID: " + connID + " is ready.");
@Luckshya
Luckshya / Example.nut
Last active Mar 9, 2019
Example discord code for official squirrel plugin (libdiscord)
View Example.nut
//open connection to discord
discordConn <- Discord_Open("token here");
//event onDiscord_Ready indicating that the bot has connected successfully
function onDiscord_Ready(discordHandle) {
//retrieve our connection ID
local connID = Discord_ConnID(discordHandle);
print("Discord bot at ID: " + connID + " is ready.");
}
View Example-sleepydiscord.nut
class MyDiscord extends SqDiscord.Session
{
function constructor() {
// Call the base constructor to intialize the connection
base.constructor();
// Bind our events
base.Bind(SqDiscordEvent.Ready, this, onReady);
base.Bind(SqDiscordEvent.Message, this, onMessage);
}
@Luckshya
Luckshya / Example-libdiscord.nut
Last active Mar 7, 2019
SqMod Discord Example (libdiscord)
View Example-libdiscord.nut
class MyDiscord extends SqDiscord.Session
{
function constructor() {
// Call the base constructor to intialize the connection
base.constructor();
// Bind our events
base.Bind(SqDiscordEvent.Ready, this, onReady);
base.Bind(SqDiscordEvent.Message, this, onMessage);
base.Bind(SqDiscordEvent.GuildLoaded, this, onLoaded);
You can’t perform that action at this time.