forked from Supositware/Haha-Yes
Added [attach:]
This commit is contained in:
parent
92dcea5137
commit
043ddde699
1 changed files with 27 additions and 4 deletions
|
@ -60,6 +60,20 @@ class messageListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
text = rand.random(text, message);
|
text = rand.random(text, message);
|
||||||
|
|
||||||
|
let attach = '';
|
||||||
|
|
||||||
|
if (text.includes('[attach')) {
|
||||||
|
attach = text.split(/(\[attach:.*?])/);
|
||||||
|
for (let i = 0, l = attach.length; i < l; i++) {
|
||||||
|
if (attach[i].includes('[attach:')) {
|
||||||
|
attach = attach[i].replace('[attach:', '').slice(0, -1);
|
||||||
|
i = attach.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text = text.replace(/(\[attach:.*?])/, '')
|
||||||
|
}
|
||||||
|
|
||||||
// THIS SECTION IS VERY VERY BAD MUST CHANGE
|
// THIS SECTION IS VERY VERY BAD MUST CHANGE
|
||||||
if (text.includes('[embed]')) {
|
if (text.includes('[embed]')) {
|
||||||
text = text.replace(/\[embed\]/, ' ');
|
text = text.replace(/\[embed\]/, ' ');
|
||||||
|
@ -149,11 +163,20 @@ class messageListener extends Listener {
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
|
|
||||||
return message.channel.send(embed);
|
if (attach) {
|
||||||
}
|
return message.channel.send(embed, {files: [attach]});
|
||||||
|
} else {
|
||||||
message.channel.send(text);
|
return message.channel.send(embed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attach) {
|
||||||
|
return message.channel.send(text, {files: [attach]});
|
||||||
|
} else {
|
||||||
|
return message.channel.send(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
null;
|
null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue