Skip to content

Commit

Permalink
🐛 majors and minors bugs
Browse files Browse the repository at this point in the history
Vivien Mouret committed Jun 2, 2024
1 parent 4ee4309 commit bbe7bbb
Showing 4 changed files with 37 additions and 15 deletions.
16 changes: 12 additions & 4 deletions command/pepe.js
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ module.exports = {
console.log(`[${getCurrentDatetime('comm')}] Error command pepe predict ${err}`);
return msg.edit({
'channel_id': message.channel.channel_id,
'content': response.data,
'content': language.imagineError,
'fetchReply': false,
'ephemeral': false
})
@@ -54,9 +54,17 @@ module.exports = {
executionCount += 1;
duration_average = totalDuration / executionCount;

const data = await response.data;
if (response.data == undefined) {
return msg.edit({
'channel_id': message.channel.channel_id,
'content': language.imagineError,
'fetchReply': false,
'ephemeral': false
})
.catch(err => { console.log(`[${getCurrentDatetime('comm')}] Error command pepe predict ${err}`); });
};

downloadImagesFromUrl(data[0].url, `./styles/ai/pepe-diffuser.jpg`, function () {
downloadImagesFromUrl(response.data[0].url, `./styles/ai/pepe-diffuser.jpg`, function () {
console.log(`[${getCurrentDatetime('comm')}] Image successfully downloaded from HuggingFace`);
});

@@ -91,7 +99,7 @@ module.exports = {
'description': `**${args.join(' ')}**\n${language.timeDiffuse}${duration}s
${language.timeAverage}${duration_average}s\n\n[**Pepe Diffuser**](https://huggingface.co/Dipl0/pepe-diffuser)`,
'color': randomColor(),
'image': { 'url': data[0].url },
'image': { 'url': response.data[0].url },
'author': {
'name': message.author.username,
'icon_url': message.author.avatarURL({ format: 'png', dynamic: true, size: 1024 })
2 changes: 1 addition & 1 deletion core/daftbot.js
Original file line number Diff line number Diff line change
@@ -456,7 +456,7 @@ class DaftBot {

if (message.author.id == owner) {
if (Math.random() < .05) {
let dio = this.dbClient.emojis.cache.find(emoji => emoji.name === 'daftmo1Diosama');
let dio = this.dbClient.emojis.cache.find(emoji => emoji.name === 'daftmo1Diosama').catch(err => { console.log(`[${getCurrentDatetime('comm')}] Error finding diosama : ${err}`); })
if (dio == undefined) { return console.log(`[${getCurrentDatetime('comm')}] ${message.guild.name} / ${message.channel.name} # Dio Sama not found here`); };
message.react(dio);
};
18 changes: 12 additions & 6 deletions core/mobbot.js
Original file line number Diff line number Diff line change
@@ -364,15 +364,19 @@ class MobBot {
response = await app.predict('/predict', [
'pepe ' + axios.data.data[0].game_name,
]);
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIF Success predict: `, response.data[0].path);
} catch (err) {
toggleMedia = false;
console.log(`[${getCurrentDatetime('comm')}] Error tweet command pepe predict ${err}`);
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIFRROR HuggingFace API Error ${err}`);
};

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

try {
const mediaIds = await Promise.all([
@@ -389,6 +393,7 @@ class MobBot {
\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({
@@ -397,6 +402,7 @@ class MobBot {
#${axios.data.data[0].game_name.split(' ').join('')} #daftmob #twitch #pepe\
\nhttps://twitch.tv/${axios.data.data[0].user_name}`
});
console.log(`[${getCurrentDatetime('comm')}] LIVENOTIF Tweet without media`);
break;
};
} catch (err) {
16 changes: 12 additions & 4 deletions slash/pepe.js
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ module.exports = {
console.log(`[${getCurrentDatetime('comm')}] Error command pepe predict ${err}`);
return message.editReply({
'channel_id': message.channel.channel_id,
'content': response.data,
'content': language.imagineError,
'fetchReply': false,
'ephemeral': false
})
@@ -59,9 +59,17 @@ module.exports = {
executionCount += 1;
duration_average = totalDuration / executionCount;

const data = await response.data;
if (response.data == undefined) {
return message.editReply({
'channel_id': message.channel.channel_id,
'content': language.imagineError,
'fetchReply': false,
'ephemeral': false
})
.catch(err => { console.log(`[${getCurrentDatetime('comm')}] Error command pepe predict ${err}`); });
};

downloadImagesFromUrl(data[0].url, `./styles/ai/pepe-diffuser.jpg`, function () {
downloadImagesFromUrl(response.data[0].url, `./styles/ai/pepe-diffuser.jpg`, function () {
console.log(`[${getCurrentDatetime('comm')}] Image successfully downloaded from HuggingFace`);
});

@@ -94,7 +102,7 @@ module.exports = {
'description': `**${args}**\n${language.timeDiffuse}${duration}s
${language.timeAverage}${duration_average}s\n\n[**Pepe Diffuser**](https://huggingface.co/Dipl0/pepe-diffuser)`,
'color': randomColor(),
'image': { 'url': data[0].url },
'image': { 'url': response.data[0].url },
'author': {
'name': message.user.username,
'icon_url': message.user.avatarURL({ format: 'png', dynamic: true, size: 1024 })

0 comments on commit bbe7bbb

Please sign in to comment.