Skip to content

Commit b0cd7d1

Browse files
authored
Merge pull request #28 from Mimickal/discord-js-v12-legacy
2 parents da0382b + 6c85f25 commit b0cd7d1

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

migrations/20211215035000_animated.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*******************************************************************************
2+
* This file is part of ReactionRoleBot, a role-assigning Discord bot.
3+
* Copyright (C) 2020 Mimickal (Mia Moretti).
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Affero General Public License as published by
7+
* the Free Software Foundation, version 3.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
******************************************************************************/
17+
const REACTS = 'reacts';
18+
const EMOJI_ID = 'emoji_id';
19+
20+
exports.up = function(knex) {
21+
console.error(
22+
'Warning: this is a one-way migration. Animated emoji names cannot ' +
23+
'be restored and will remain as IDs'
24+
);
25+
26+
return knex(REACTS)
27+
.select(EMOJI_ID)
28+
.where(EMOJI_ID, 'like', '<a:%')
29+
.then(rows => Promise.all(
30+
rows.map(row => knex(REACTS)
31+
.where({ [EMOJI_ID]: row[EMOJI_ID] })
32+
.update({ [EMOJI_ID]: row[EMOJI_ID].match(/<a?:.+:(\d{17,21})>/)[1] })
33+
)
34+
));
35+
};
36+
37+
exports.down = function(knex) {
38+
console.error('Cannot restore original animated emoji names');
39+
};
40+

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "reactionrolebot",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"description": "I'm a basic, no BS Discord bot that can assign and unassign roles using message reactions. I am completely free and open source, and always will be.",
55
"main": "main.js",
66
"dependencies": {

0 commit comments

Comments
 (0)