Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions modules/twitch-notifications/configs/streamers.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
{
"name": "%url%",
"description": "Link to the stream"
},
{
"name": "%title%",
"description": "Title of the Stream"
},
{
"name": "%thumbnailUrl%",
"description": "The Link to the thumbnail of the Stream"
}
],
"params-de": [
Expand All @@ -40,6 +48,14 @@
{
"name": "%url%",
"description": "Link zum Twitch-Stream"
},
{
"name": "%title%",
"description": "Titel des Streams"
},
{
"name": "%thumbnailUrl%",
"description": "Link zum Thumbnail des Streams"
}
]
},
Expand Down
13 changes: 7 additions & 6 deletions modules/twitch-notifications/events/botReady.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const {localize} = require('../../../src/functions/localize');
/**
* General program
* @param {Client} client Discord js Client
* @param {object} apiClient Twitch API Client
* @param {ApiClient} apiClient Twitch API Client
* @private
*/
function twitchNotifications(client, apiClient) {
Expand All @@ -26,22 +26,23 @@ function twitchNotifications(client, apiClient) {
* @returns {*}
* @private
*/
function sendMsg(username, game, thumbnailUrl, channelID, i) {
function sendMsg(username, game, thumbnailUrl, channelID, title, i) {
const channel = client.channels.cache.get(channelID);
if (!channel) return client.logger.fatal(`[twitch-notifications] ` + localize('twitch-notifications', 'channel-not-found', {c: channelID}));
if (!streamers[i]['liveMessage']) return client.logger.fatal(`[twitch-notifications] ` + localize('twitch-notifications', 'message-not-found', {s: username}));
channel.send(embedType(streamers[i]['liveMessage'], {
'%streamer%': username,
'%game%': game,
'%url%': `https://twitch.tv/${username.toLowerCase()}`,
'%thumbnailUrl': thumbnailUrl
'%thumbnailUrl%': thumbnailUrl,
'%title%': title
}));
}

/**
* Checks if the streamer is live
* @param {string} userName Name of the Streamer
* @returns {object}
* @returns {HelixStream}
* @private
*/
async function isStreamLive(userName) {
Expand Down Expand Up @@ -73,11 +74,11 @@ function twitchNotifications(client, apiClient) {
name: value.streamer.toLowerCase(),
startedAt: stream.startDate.toString()
});
sendMsg(stream.userDisplayName, stream.gameName, stream.thumbnailUrl, streamers[index]['liveMessageChannel'], index);
sendMsg(stream.userDisplayName, stream.gameName, stream.thumbnailUrl, streamers[index]['liveMessageChannel'], stream.title, index);
} else if (stream !== null && stream.startDate.toString() !== streamer.startedAt) {
streamer.startedAt = stream.startDate.toString();
streamer.save();
sendMsg(stream.userDisplayName, stream.gameName, stream.thumbnailUrl, streamers[index]['liveMessageChannel'], index);
sendMsg(stream.userDisplayName, stream.gameName, stream.thumbnailUrl, streamers[index]['liveMessageChannel'], stream.title, index);
}
}
}
Expand Down