Diff
checker
Text
Text
Images
Documents
Excel
Folders
Legal
Enterprise
Desktop
Pricing
Sign in
Download Diffchecker Desktop
Compare text
Find the difference between two text files
Tools
History
Real-time editor
Hide unchanged lines
Disable line wrap
Layout
Split
Unified
Diff precision
Smart
Word
Char
Syntax highlighting
Choose syntax
Ignore
Transform text
Go to first change
Edit input
Diffchecker Desktop
The most secure way to run Diffchecker. Get the Diffchecker Desktop app: your diffs never leave your computer!
Get Desktop
code diff twitch follows
Created
4 years ago
Diff never expires
Clear
Export
Share
Explain
3 removals
Lines
Total
Removed
Characters
Total
Removed
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
53 lines
Copy
1 addition
Lines
Total
Added
Characters
Total
Added
To continue using this feature, upgrade to
Diff
checker
Pro
View Pricing
53 lines
Copy
import common from "../common-polling.mjs";
import common from "../common-polling.mjs";
export default {
export default {
...common,
...common,
name: "New Follower (Instant)",
name: "New Follower (Instant)",
key: "twitch-new-follower",
key: "twitch-new-follower",
description: "Emit new event when a new user follows your channel.",
description: "Emit new event when a new user follows your channel.",
type: "source",
type: "source",
version: "0.0.4",
version: "0.0.4",
methods: {
methods: {
...common.methods,
...common.methods,
async getTopics() {
async getTopics() {
// get the authenticated user
// get the authenticated user
const { data } = await this.twitch.getUsers();
const { data } = await this.twitch.getUsers();
return [
return [
`users/follows?first=1&to_id=${data[0].id}`,
`users/follows?first=1&to_id=${data[0].id}`,
];
];
},
},
getMeta(item) {
getMeta(item) {
const {
const {
Copy
Copied
Copy
Copied
from_id,
to_id, followed_at, from_name,
to_id, followed_at, from_name,
} = item;
} = item;
return {
return {
Copy
Copied
Copy
Copied
id:
from_id +
to_id + followed_at,
id:
to_id + followed_at,
summary: `${from_name} is a new follower`,
summary: `${from_name} is a new follower`,
ts: new Date(followed_at).getTime(),
ts: new Date(followed_at).getTime(),
};
};
},
},
},
},
hooks: {
hooks: {
async deploy() {
async deploy() {
// get the authenticated user
// get the authenticated user
const { data: authenticatedUserData } = await this.twitch.getUsers();
const { data: authenticatedUserData } = await this.twitch.getUsers();
this.db.set("authenticatedUserId", authenticatedUserData[0].id);
this.db.set("authenticatedUserId", authenticatedUserData[0].id);
},
},
},
},
async run() {
async run() {
const params = {
const params = {
Copy
Copied
Copy
Copied
from
_id: this.db.get("authenticatedUserId"),
to
_id: this.db.get("authenticatedUserId"),
};
};
// get the user_ids of the streamers followed by the authenticated user
// get the user_ids of the streamers followed by the authenticated user
const follows = this.paginate(
const follows = this.paginate(
this.twitch.getUserFollows.bind(this),
this.twitch.getUserFollows.bind(this),
params,
params,
);
);
for await (const follow of follows) {
for await (const follow of follows) {
this.$emit(follow, this.getMeta(follow));
this.$emit(follow, this.getMeta(follow));
}
}
},
},
};
};
Saved diffs
Original text
Open file
import common from "../common-polling.mjs"; export default { ...common, name: "New Follower (Instant)", key: "twitch-new-follower", description: "Emit new event when a new user follows your channel.", type: "source", version: "0.0.4", methods: { ...common.methods, async getTopics() { // get the authenticated user const { data } = await this.twitch.getUsers(); return [ `users/follows?first=1&to_id=${data[0].id}`, ]; }, getMeta(item) { const { from_id, to_id, followed_at, from_name, } = item; return { id: from_id + to_id + followed_at, summary: `${from_name} is a new follower`, ts: new Date(followed_at).getTime(), }; }, }, hooks: { async deploy() { // get the authenticated user const { data: authenticatedUserData } = await this.twitch.getUsers(); this.db.set("authenticatedUserId", authenticatedUserData[0].id); }, }, async run() { const params = { from_id: this.db.get("authenticatedUserId"), }; // get the user_ids of the streamers followed by the authenticated user const follows = this.paginate( this.twitch.getUserFollows.bind(this), params, ); for await (const follow of follows) { this.$emit(follow, this.getMeta(follow)); } }, };
Changed text
Open file
import common from "../common-polling.mjs"; export default { ...common, name: "New Follower (Instant)", key: "twitch-new-follower", description: "Emit new event when a new user follows your channel.", type: "source", version: "0.0.4", methods: { ...common.methods, async getTopics() { // get the authenticated user const { data } = await this.twitch.getUsers(); return [ `users/follows?first=1&to_id=${data[0].id}`, ]; }, getMeta(item) { const { to_id, followed_at, from_name, } = item; return { id: to_id + followed_at, summary: `${from_name} is a new follower`, ts: new Date(followed_at).getTime(), }; }, }, hooks: { async deploy() { // get the authenticated user const { data: authenticatedUserData } = await this.twitch.getUsers(); this.db.set("authenticatedUserId", authenticatedUserData[0].id); }, }, async run() { const params = { to_id: this.db.get("authenticatedUserId"), }; // get the user_ids of the streamers followed by the authenticated user const follows = this.paginate( this.twitch.getUserFollows.bind(this), params, ); for await (const follow of follows) { this.$emit(follow, this.getMeta(follow)); } }, };
Find difference