tskubicki / discord-xmpp

A bot for Discord that transfers chat messages between a Discord channel and a XMPP-based Multi-user Chatroom (MUC).
BSD 2-Clause "Simplified" License
33 stars 7 forks source link

Relay with no 'confrence' #4

Open djyumene opened 7 years ago

djyumene commented 7 years ago

What I am trying to do is this, relay between a PM in a xmpp client to discord.

Basically: I am trying to set this up for my alliance in Eve Online. We are part of a coalition that uses jabber to relay fleet broadcasts. We already have so many tools that we have to have open during the game, and we are trying to consolidate and make things more efficient; including getting those pings relayed into our alliance discord.

I was hoping that this would be able to do that, but it asks for the xmpp conference id, but there is none since the broadcasts are given in a private message window from the ping bot.

So this is what I have, and it obviously doesn't work:

const DISCORD_API_TOKEN = 'myapitoken'; const DISCORD_CHATROOM_ID = 'myroomid'; const JID = 'myusername@fcon.us'; const PASSWORD = 'mypassword'; const ROOM_JID = 'botusername@fcon.us'; const HOST = 'fcon.us'; const PORT = 5222;

tskubicki commented 7 years ago

Let me see what I can do. I'll update you before the weekend is done.

tskubicki commented 7 years ago

Try commenting out line 115 and see if it works, like the below:

if (stanza.is('message') && //stanza.attrs.type === 'groupchat' &&
stanza.attrs.from !== ROOM_JID + '/' + IN_CHANNEL_BOT_NAME){

Let me know how it goes.

tskubicki commented 7 years ago

Just pushed up some fixes. Give it a try first.

Maulth commented 7 years ago

Did this get sorted? I'm attempting to do roughly the same thing.

tskubicki commented 7 years ago

Not yet. I was hoping to get an answer back to see if it worked out. Can you go to line 160 and change it from this: if (stanza.is('message') && stanza.attrs.type === 'groupchat' && stanza.attrs.from !== ROOM_JID + '/' + IN_CHANNEL_BOT_NAME)

to this:

if (stanza.is('message') && stanza.attrs.from !== ROOM_JID + '/' + IN_CHANNEL_BOT_NAME)

and let me know if it works out? you can leave the chatroom field blank

Maulth commented 7 years ago

I just connected it to the server. Entered a private message from another one of my accounts and got this error:

/home/relaybot/discord-xmpp/app.js:183 discord.channel.sendMessage(message); ^

TypeError: Cannot read property 'sendMessage' of undefined at Client. (/home/relaybot/discord-xmpp/app.js:183:18) at emitOne (events.js:96:13) at Client.emit (events.js:188:7) at Client._handleStanza (/home/relaybot/discord-xmpp/node_modules/node-xmpp-client/lib/Client.js:227:12) at Client.onStanza (/home/relaybot/discord-xmpp/node_modules/node-xmpp-client/lib/Client.js:221:8) at emitOne (events.js:96:13) at Connection.emit (events.js:188:7) at Connection.onStanza (/home/relaybot/discord-xmpp/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/Connection.js:377:10) at StreamParser. (/home/relaybot/discord-xmpp/node_modules/node-xmpp-client/node_modules/node-xmpp-core/lib/Connection.js:231:10) at emitOne (events.js:96:13) username@machine:/home/relaybot/discord-xmpp#

tskubicki commented 7 years ago

Sorry for the wait

Can you copy/paste this into line 182 and tell me what it spits out? "console.log(discord.channel);"

ryanrenn commented 6 years ago

hey there, i'm trying to do the same thing and am running into the same wall.

I am able to successfully join a channel and relay info back and forth without any issue. but if I set it to get messages from our "pings" bot on the xmpp side... I don't get any action.

console.log(discord.channel); doesn't return anything.