Skip to content

Instantly share code, notes, and snippets.

View meew0's full-sized avatar

meew0 meew0

View GitHub Profile
  • 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
@meew0
meew0 / bulba-parser.rb
Created May 7, 2016 15:39
Ruby script to parse a dump of Bulbapedia's Pokémon pages into obtainability data
# 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
@meew0
meew0 / battle.rb
Created August 24, 2016 18:54
Elgyem .battle command
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 / ping.cr
Created September 4, 2016 20:09
discordcr ping bot
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

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 / delegate_class.js
Last active October 1, 2016 17:00
Ruby's DelegateClass, implemented in ES6
// 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 {
@meew0
meew0 / guidelines.md
Last active September 23, 2023 18:09
Guidelines for lib inclusion on Discord API

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 / apitosqa.md
Last active December 22, 2022 04:10
API ToS Q&A Summary

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