Skip to content

Instantly share code, notes, and snippets.

Évelyne Lachance eslachance

View GitHub Profile
@eslachance
eslachance / example.js
Created Oct 22, 2018
Koa an Express Example
View example.js
/ Native Imports
const { sep, resolve, join } = require("path");
// Enmap Imports
const Enmap = require("enmap");
const users = new Enmap({ name: "users" });
// Bcrypt's hashing system
const bcrypt = require("bcrypt");
@eslachance
eslachance / README.md
Last active Mar 12, 2019
SQLite Points Bot
View README.md

SQLite-based Points Bot

This is the example code for This Guide. Please read that guide to understand the code provided here.

On the other hand, if you know what you're doing, here's a quick how-to:

  • In an admin command prompt or powershell, run npm i -g --production windows-build-tools.
  • Close all open command prompts for your bot, or the following won't work.
  • npm i discord.js better-sqlite3
  • Create app.js and config.json per below.
  • Make sure to get your bot token in the config.json.
@eslachance
eslachance / README.md
Last active Mar 14, 2019
Using Enmap for a points system
View README.md

Enmap Points Example

COMPATIBLE WITH VERSION 4 ONLY: Please note that the below has been updated to Enmap 4 and will not work in previous versions! Make sure to update Enmap if it's already installed!

This example uses a very, very simple bot made in discord.js to demonstrate how easily Enmap can be used to create a points system.

Installation

This code requires the following installation on Windows:

View keybase.md

Keybase proof

I hereby claim:

  • I am eslachance on github.
  • I am eslachance (https://keybase.io/eslachance) on keybase.
  • I have a public key ASDxK1jo_eBEkvGX7AEaeLt0Y0-TGcTvxqqwJ07j_vh1Dgo

To claim this, I am signing this object:

@eslachance
eslachance / index.js
Created Oct 3, 2017
Discord.js Bot Guide Season 2 - Episode 4 Code
View index.js
/* eslint consistent-return: 0, no-console: 0 */
const Discord = require('discord.js');
const client = new Discord.Client();
client.config = require('./config.json');
client.log = require('./functions/log.js');
client.commands = new Discord.Collection();
@eslachance
eslachance / README.md
Last active Mar 6, 2019
Using Enmap for per-server configurations
View README.md

Enmap Example

COMPATIBLE WITH VERSION 4 ONLY: Please note that the below has been updated to Enmap 4 and will not work in previous versions! Make sure to update Enmap if it's already installed!

This example uses a very, very simple bot made in discord.js to demonstrate how easily Enmap can be used to create a per-server configuration system.

Installation

This code requires the following installation on Windows:

@eslachance
eslachance / index.js
Last active Apr 15, 2019
Simple, complete example of a bot in Discord.js
View index.js
// Load up the discord.js library
const Discord = require("discord.js");
// This is your client. Some people call it `bot`, some people call it `self`,
// some might call it `cootchie`. Either way, when you see `client.something`, or `bot.something`,
// this is what we're refering to. Your client.
const client = new Discord.Client();
// Here we load the config.json file that contains our token and our prefix values.
const config = require("./config.json");
@eslachance
eslachance / index.php
Last active Mar 27, 2019
example-oauth2-php
View index.php
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if (isset($_GET["error"])) {
echo json_encode(array("message" => "Authorization Error"));
} elseif (isset($_GET["code"])) {
Header("Location: login.php?code={$_GET["code"]}");
@eslachance
eslachance / discord-etiquette.md
Last active Feb 8, 2019
Order in Discord - the Discord Etiquette
View discord-etiquette.md

Discord Etiquette and Savoir-Vivre

So, you're on Discord and you're wondering, what is generally allowed, and what isn't on this thing? What can I freely do, and what will get me kicked or banned?

TL;DR: Don't be a dick

This document attempts to answer this in a meaningful manner. Note however that each server is different, and each have their own rules. This is by no means an extensive, official list but rather general guidelines to follow.

@eslachance
eslachance / app.js
Created Nov 21, 2016
Episode 5 Code
View app.js
const Discord = require("discord.js");
const bot = new Discord.Client();
const config = require("./config.json");
bot.on("ready", () => {
console.log("I am ready!");
});
bot.on("guildMemberAdd", member => {
You can’t perform that action at this time.