Skip to content

Instantly share code, notes, and snippets.

Avatar

meew0 meew0

  • Germany
View GitHub Profile
@meew0
meew0 / apitosqa.md
Last active Oct 31, 2020
API ToS Q&A Summary
View apitosqa.md

This is a summary of the Q&A regarding the new API ToS that took place in the #api channel on the Discord API server, starting around midnight UTC on Thursday, August 17, 2017.

All answers are from b1nzy unless marked otherwise. This is just a summary of my (meew0) own interpretation of the Q&A; obviously this shouldn't be interpreted as anything legally binding. If in doubt, ask the devs yourself or consult a lawyer. I'm not responsible if you get banned or sued because of this document. All subsequent usages of first-person pronouns refer to the people asking/answering the questions, respectively.

Q. How do we detect users deleting their accounts, if we have to delete their data within 7 days?
A. You will get an email by Discord if that happens. Make sure the account that registered the bot application has an email attached to it that you actually get messages with. This may change in the future but if it will, there will be plenty of time before the new mechanism goes into effect.

Q. **Do we need

@meew0
meew0 / guidelines.md
Last active Aug 12, 2020
Guidelines for lib inclusion on Discord API
View guidelines.md

There seems to be a lot of confusion regarding what exactly is required for a lib to be included in Discord API (i.e. get a channel, get listed in #info, and all the other good stuff). I've written all of the guidelines down as they were usually handled in the past and how they should be handled in the future, in my opinion. All of these are just guidelines - if you have a good enough reason to not meet a particular requirement, that's fine.

  • It should support the entire documented API featureset (minus voice). You can support undocumented stuff too if you want, but the entire documented featureset is a good minimum that can be expected of everyone who cares about their lib. (This seems more overwhelming than it really is.) Voice support is explicitly not required because there are many technical and non-technical reasons to not have it.
  • It should support advanced gateway features such as RESUMEs. There is a [rate limit on starting sessions](https://github.com/hammerandchisel/discord-api-doc
@meew0
meew0 / delegate_class.js
Last active Oct 1, 2016
Ruby's DelegateClass, implemented in ES6
View delegate_class.js
// See http://ruby-doc.org/stdlib-2.3.1/libdoc/delegate/rdoc/Object.html for more information
// Some example classes...
class User {
constructor(username) {
this.username = username;
}
}
class Server {
View keybase.md

Keybase proof

I hereby claim:

  • I am meew0 on github.
  • I am meew0 (https://keybase.io/meew0) on keybase.
  • I have a public key whose fingerprint is B777 2508 3140 303C CE9B EF3E 204E 4580 0AF8 8222

To claim this, I am signing this object:

@meew0
meew0 / ping.cr
Created Sep 4, 2016
discordcr ping bot
View ping.cr
require "discordcr"
client = Discord::Client.new(token: "token", client_id: 12345_u64)
client.on_message do |payload|
client.create_message(payload.channel_id, "Pong!")
end
client.run
@meew0
meew0 / battle.rb
Created Aug 24, 2016
Elgyem .battle command
View battle.rb
module Elgyem::Battle
extend ElgyemCommand
# OU, UU, RU, NU, PU, Ubers, BSS - or singles for all
# BSD, VGC, DOU, DUU, DUbers - or doubles for all
# BST, TOU - or triples for all
# BSS, BSD, BST - or battlespot for all
# OU, UU, RU, NU, PU, Ubers - or smogon for all
# Random
@meew0
meew0 / bulba-parser.rb
Created May 7, 2016
Ruby script to parse a dump of Bulbapedia's Pokémon pages into obtainability data
View bulba-parser.rb
# This script parses a dump of Bulbapedia's Pokémon pages into a JSON file
# with details about what Pokémon are obtainable in respective regions
# (specifically, the latest series of games set in a specific region).
require 'nokogiri'
require 'json'
# An XML dump of all of Bulbapedia's Pokémon pages is required to exist at
# this path. It can be generated using this special page:
# http://bulbapedia.bulbagarden.net/wiki/Special:Export
View 2.0.0-ff8431a-changes.md
  • Bot initializers now only use named parameters. This shouldn't be a hard change to adjust to, but everyone will have to do it. Here's some examples:
# Previously
bot = Discordrb::Bot.new 'email@example.com', 'hunter2', true

# Now
bot = Discordrb::Bot.new email: 'email@example.com', password: 'hunter2', log_mode: :debug
# Previously
View agarify.rb
module Elgyem::Agarify
extend ElgyemCommand
AGAR_ALPHABETS = [
# Exclude the boxed letters because they can look weird in Discord
# [9398, 9399, 9400, 9401, 9402, 9403, 9404, 9405, 9406, 9407, 9408, 9409, 9410, 9411, 9412, 9413, 9414, 9415, 9416, 9417, 9418, 9419, 9420, 9421, 9422, 9423],
# [9424, 9425, 9426, 9427, 9428, 9429, 9430, 9431, 9432, 9433, 9434, 9435, 9436, 9437, 9438, 9439, 9440, 9441, 9442, 9443, 9444, 9445, 9446, 9447, 9448, 9449],
[945, 1074, 162, 8706, 1108, 402, 103, 1085, 953, 1504, 1082, 8467, 1084, 951, 963, 961, 113, 1103, 1109, 1090, 965, 957, 969, 967, 1091, 122],
[65313, 65314, 65315, 65316, 65317, 65318, 65319, 65320, 65321, 65322, 65323, 65324, 65325, 65326, 65327, 65328, 65329, 65330, 65331, 65332, 65333, 65334, 65335, 65336, 65337, 65338],
[65345, 65346, 65347, 65348, 65349, 65350, 65351, 65352, 65353, 65354, 65355, 65356, 65357, 65358, 65359, 65360, 65361, 65362, 65363, 65364, 65365, 65366, 65367, 65368, 65369, 65370],
@meew0
meew0 / 2.0.0.md
Created Mar 11, 2016
discordrb 2.0.0 planned changes
View 2.0.0.md

Definite changes

  • Users will be divided into User and Member classes, where User represents a global user and Member represents a user on a server. This is both cleaner and easier to do because Discord already separates these two things in the API.
  • WebSocket connections will be using a wrapper class instead of Faye/WSCS directly. This lets me switch both WSes to WSCS which doesn't rely on EventMachine (and if I'm dissatisfied with WSCS I can switch to something else entirely).
  • Caching code will be separated into a module and redone somewhat
  • Some stuff will be made more consistent, like server vs guild
  • The bot initializers will be restructured to only have an arguments hash that specifies everything
  • Removal of all the deprecated stuff

I will also support any changes to the API when they come out, like sharding.

You can’t perform that action at this time.