An overview of all events in Discord.js v14 with examples.
📢 | Last updated: 27 July 2022
ℹ️ | client
references to your client instance.
ℹ️ | The v13 overview can be found here.
""" | |
It took me far longer than necessary to figure out how to use yt-dlp to trim/download a subset of a longer video | |
outside the context of a command line (i.e., directly in Python), so I'm recording it here for posterity. | |
There's no shortage of command-line examples of using `--ppa "ffmpeg_i:[...]`, but the documentation doesn't | |
exactly make it clear how to translate this to the Python version of the options, so here goes. A couple | |
additional quirks come into play too; we'll get to those soon enough. | |
""" | |
import yt_dlp |
An overview of all events in Discord.js v14 with examples.
📢 | Last updated: 27 July 2022
ℹ️ | client
references to your client instance.
ℹ️ | The v13 overview can be found here.
// Welcome to my gist! This is how you can create an invite tracker using JavaScript and Discord.JS! | |
// First we are going to statt off in our ready event. | |
// Create a new Collection called guildInvites and add it to your client | |
// client is the new Client you created in your main file. If you're using an event handler, make sure to pass the client into this file. | |
const { Collection } = require("discord.js"); | |
// Collection is an enhanced Map which we are going to save our invites to. | |
const guildInvites = new Collection(); | |
client.invites = guildInvites; |
Recommendations of unit types per media type:
Media | Recommended | Occasional use | Infrequent use | Not recommended |
---|---|---|---|---|
Screen | em, rem, % | px | ch, ex, vw, vh, vmin, vmax | cm, mm, in, pt, pc |
em, rem, % | cm, mm, in, pt, pc | ch, ex | px, vw, vh, vmin, vmax |
//Update one annotation | |
app.put('/api/annotations/:req_id', (req, res) => { | |
const { | |
qoute, | |
ranges, | |
text, | |
id | |
} = req.body; | |
const { | |
req_id |
{ | |
"total": 43127, | |
"rows": [ | |
{ | |
"id": "d41d8cd98f00b204e9800998ecf8427e", | |
"text": "Updated annotation text", | |
... | |
}, | |
... | |
] |
app.get('/api/search/:name', (req, res) => { | |
const { | |
name | |
} = req.params; | |
db.find({ file_name: name }).then(doc => { | |
let annotations = []; | |
doc.forEach(n => { | |
annotations.push(n.rows); | |
}); | |
res.json({ |
//Create annotations | |
app.post('/api/annotations/:name', (req, res) => { | |
//create a random id object for annotations | |
let id = uuidv4(); | |
const { | |
qoute, | |
ranges, | |
text | |
} = req.body; | |
const { |
//Our custom function to add uri into annotations | |
var pageUri = function () { | |
return { | |
beforeAnnotationCreated: function (ann) { | |
ann.uri = window.location.href; | |
} | |
}; | |
}; | |
//Init Annotatorjs | |
var app = new annotator.App() |
Run pip install pipenv
to install pipenv
Run pipenv shell
to create an environment, if does not exist, and activate it.
Run pipenv install python_decouple whitenoise dj_database_url Pillow gunicorn
May take a while.
This should create two files: Pipfile
and Pipfile.lock
. Keep them in the project root.