Skip to content

Commit

Permalink
🔥 cancel tweet
Browse files Browse the repository at this point in the history
Vivien Mouret committed Jul 5, 2024
1 parent 94ae836 commit b49dc97
Showing 1 changed file with 51 additions and 51 deletions.
102 changes: 51 additions & 51 deletions core/mobbot.js
Original file line number Diff line number Diff line change
@@ -339,7 +339,7 @@ class MobBot {
return console.log(`[${getCurrentDatetime('comm')}] Error function liveNotif() : GUID [${gD}] and/or AXIOS [${axios}]`);
};

const { client } = await dynamic('@gradio/client');
// const { client } = await dynamic('@gradio/client');
let guidDot = gD,
channelTwitch = ['💻incoming', '🎦-fox-stream-🎦', 'twitch-support-🎥', 'bots'],
guid = '',
@@ -355,56 +355,56 @@ class MobBot {
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIFRROR Can't get guid and dot : `, err);
};

let app = await client('vivsmouret/pepe-diffuser'),
response = undefined,
toggleMedia = true;

try {
response = await app.predict('/predict', [
'pepe is playing at ' + axios.data.data[0].game_name,
]);
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIF Success predict: `, await response.data[0].path);
} catch (err) {
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIFRROR HuggingFace API Error ${err}`);
};

if (await response == undefined) {
toggleMedia = false;
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIFRROR Get response data : `, response);
} else {
downloadImagesFromUrl(await response.data[0].url, `./styles/ai/pepe-diffuser-x.jpg`, function () {
console.log(`[${getCurrentDatetime('comm')}] Image successfully downloaded from HuggingFace`);
});
};

try {
switch (toggleMedia) {
case true:
const mediaIds = await Promise.all([
xApi.v1.uploadMedia('./styles/ai/pepe-diffuser-x.jpg')
]);

await rwClient.v2.tweet({
text: `${axios.data.data[0].title}\
\n#daftmob #${axios.data.data[0].game_name.split(' ').join('')} #twitch #pepe\
\n\nhttps://twitch.tv/${axios.data.data[0].user_name}`,
media: { media_ids: mediaIds }
});
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIF Tweet with media`);
break;
case false:
await rwClient.v2.tweet({
text: `${axios.data.data[0].title}\
\n#daftmob #${axios.data.data[0].game_name.split(' ').join('')} #twitch #pepe\
\n\nhttps://twitch.tv/${axios.data.data[0].user_name}`
});
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIF Tweet without media`);
toggleMedia = true;
break;
};
} catch (err) {
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIFRROR XAPI Tweet Error : `, err);
};
// let app = await client('vivsmouret/pepe-diffuser'),
// response = undefined,
// toggleMedia = true;

// try {
// response = await app.predict('/predict', [
// 'pepe is playing at ' + axios.data.data[0].game_name,
// ]);
// console.log(`[${getCurrentDatetime('comm')}] LIVENOTIF Success predict: `, await response.data[0].path);
// } catch (err) {
// console.log(`[${getCurrentDatetime('comm')}] LIVENOTIFRROR HuggingFace API Error ${err}`);
// };

// if (await response == undefined) {
// toggleMedia = false;
// console.log(`[${getCurrentDatetime('comm')}] LIVENOTIFRROR Get response data : `, response);
// } else {
// downloadImagesFromUrl(await response.data[0].url, `./styles/ai/pepe-diffuser-x.jpg`, function () {
// console.log(`[${getCurrentDatetime('comm')}] Image successfully downloaded from HuggingFace`);
// });
// };

// try {
// switch (toggleMedia) {
// case true:
// const mediaIds = await Promise.all([
// xApi.v1.uploadMedia('./styles/ai/pepe-diffuser-x.jpg')
// ]);

// await rwClient.v2.tweet({
// text: `${axios.data.data[0].title}\
// \n#daftmob #${axios.data.data[0].game_name.split(' ').join('')} #twitch #pepe\
// \n\nhttps://twitch.tv/${axios.data.data[0].user_name}`,
// media: { media_ids: mediaIds }
// });
// console.log(`[${getCurrentDatetime('comm')}] LIVENOTIF Tweet with media`);
// break;
// case false:
// await rwClient.v2.tweet({
// text: `${axios.data.data[0].title}\
// \n#daftmob #${axios.data.data[0].game_name.split(' ').join('')} #twitch #pepe\
// \n\nhttps://twitch.tv/${axios.data.data[0].user_name}`
// });
// console.log(`[${getCurrentDatetime('comm')}] LIVENOTIF Tweet without media`);
// toggleMedia = true;
// break;
// };
// } catch (err) {
// console.log(`[${getCurrentDatetime('comm')}] LIVENOTIFRROR XAPI Tweet Error : `, err);
// };

for (let chan in channelTwitch) {
var channelSend = client_.channels.cache.find(channel => channel.name == channelTwitch[chan]);

0 comments on commit b49dc97

Please sign in to comment.