Skip to content

Instantly share code, notes, and snippets.

@hdeshev
hdeshev / delete-all-messages.js
Last active May 2, 2020 07:07 — forked from rcx/delete-all-messages.js
Delete all your messages in a Discord channel
clearMessages = function (guild_id, authToken, deleted = new Set(), interval = 1000) {
/*
* Discord: Don't copy stuff into this box
* Me: dOn'T COpy sTuFf iNtO tHIs bOx
*/
const searchURL = `https://discordapp.com/api/v6/guilds/${guild_id}/messages/search?include_nsfw=true`
const headers = { Authorization: authToken }
let clock = 0
function delay(duration) {
return new Promise((resolve, reject) => {
import * as hookMod from 'angular2/src/router/lifecycle_annotations';
import * as routerMod from 'angular2/src/router/router';
import {isBlank, isPresent} from 'angular2/src/facade/lang';
import {StringMapWrapper} from 'angular2/src/facade/collection';
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
import {BaseException} from 'angular2/src/facade/exceptions';
import {
ElementRef, DynamicComponentLoader, Directive, Injector, provide, ComponentRef, Attribute
} from 'angular2/core';
import {
@hdeshev
hdeshev / set_attributes.py
Created August 24, 2012 12:12 — forked from skanev/set_attributes.py
Set arguments passed to the constructor as attributes
import inspect
from functools import wraps
def set_attributes(constructor):
@wraps(constructor)
def wrapped(self, *args, **kwargs):
names = inspect.getargspec(constructor).args
for (key, value) in dict(zip(names[1:], args)).items():
setattr(self, key, value)
for (key, value) in kwargs.items():