revert new thing
This commit is contained in:
parent
3ef1bccb7a
commit
7fe2b0fa12
|
@ -97,6 +97,7 @@ global.createMPPbridge = async function createMPPbridge({room, channel, uri}) {
|
||||||
|
|
||||||
// MPP to Discord
|
// MPP to Discord
|
||||||
gClient.on('a', async msg => {
|
gClient.on('a', async msg => {
|
||||||
|
if (msg.p._id == gClient.getOwnParticipant()._id) return;
|
||||||
var id = msg.p._id.substr(0,6);
|
var id = msg.p._id.substr(0,6);
|
||||||
var name = sanitizeName(msg.p.name);
|
var name = sanitizeName(msg.p.name);
|
||||||
var content = msg.a;
|
var content = msg.a;
|
||||||
|
@ -106,26 +107,28 @@ global.createMPPbridge = async function createMPPbridge({room, channel, uri}) {
|
||||||
|
|
||||||
// Discord to MPP
|
// Discord to MPP
|
||||||
{
|
{
|
||||||
//let msgQueue = [];
|
let msgQueue = [];
|
||||||
dClient.on('message', async message => {
|
dClient.on('message', async message => {
|
||||||
if (message.channel.id !== channel.id || message.author.id == dClient.user.id || !message.member /*|| message.content.startsWith('!')*/) return;
|
if (message.channel.id !== channel.id || message.author.id == dClient.user.id || !message.member /*|| message.content.startsWith('!')*/) return;
|
||||||
var str = message.cleanContent;
|
var str = message.cleanContent;
|
||||||
var aname = message.author.tag;
|
var aname = message.author.tag;
|
||||||
//if (str.startsWith('/') || str.startsWith('\\'))
|
if (str.startsWith('/') || str.startsWith('\\'))
|
||||||
// msgQueue.push(`⤹ ${aname}`);
|
msgQueue.push(`⤹ ${aname}`);
|
||||||
//else
|
else
|
||||||
str = `${aname}: ${str}`;
|
str = `${aname}: ${str}`;
|
||||||
//if (str.startsWith('\\')) str = str.slice(1);
|
if (str.startsWith('\\')) str = str.slice(1);
|
||||||
if (message.attachments.size > 0) str += ' ' + message.attachments.map(a => a.url).join(' ');
|
if (message.attachments.size > 0) str += ' ' + message.attachments.map(a => a.url).join(' ');
|
||||||
if (str.length > 512) str = str.substr(0,511) + '…';
|
if (str.length > 512) {
|
||||||
//msgQueue.push(str);
|
str = str.substr(0,511) + '…';
|
||||||
gClient.sendArray([{m:'a', message: str}]);
|
message.react('⚠');
|
||||||
if (gClient.isConnected()) message.delete();
|
}
|
||||||
|
msgQueue.push(str);
|
||||||
});
|
});
|
||||||
//setInterval(()=>{
|
setInterval(()=>{
|
||||||
// let message = msgQueue.shift();
|
let message = msgQueue.shift();
|
||||||
// if (message) gClient.sendArray([{m:'a', message}]);
|
if (message) gClient.sendArray([{m:'a', message}]);
|
||||||
//}, 1600); // just about fastest without exceeding quota; I figured quota is 4 messages per 6 seconds in lobbies
|
//todo wait moment to see if message got through then react warning if didnt
|
||||||
|
}, 1600); // just about fastest without exceeding quota; I figured quota is 4 messages per 6 seconds in lobbies
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue