tskubicki / discord-xmpp Goto Github PK
View Code? Open in Web Editor NEWA bot for Discord that transfers chat messages between a Discord channel and a XMPP-based Multi-user Chatroom (MUC).
License: BSD 2-Clause "Simplified" License
A bot for Discord that transfers chat messages between a Discord channel and a XMPP-based Multi-user Chatroom (MUC).
License: BSD 2-Clause "Simplified" License
Please add a license file in the repo.
Exactly what it says on the tin. Now that I have the bot actually running, it doesn't seem to want to listen to me and send where it should. No matter what channel ID I give it, it pops everything off to #general anyway.
Nothing shows in the debug log that seems out of place - just Discord heartbeats and logs of messages being sent.
I am not really quite sure if i just doing something wrong here, since i am still new to node.js but i have problems with getting all the dependencies to run this bot.
Here is a full log:
npm http GET https://registry.npmjs.org/node-xmpp-client
npm http GET https://registry.npmjs.org/tinyurl
npm http GET https://registry.npmjs.org/discord.js
npm http 304 https://registry.npmjs.org/node-xmpp-client
npm http 304 https://registry.npmjs.org/tinyurl
npm http 304 https://registry.npmjs.org/discord.js
npm WARN engine [email protected]: wanted: {"node":">=6.0.0"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm http GET https://registry.npmjs.org/browser-request
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/md5.js
npm http GET https://registry.npmjs.org/minimist
npm http GET https://registry.npmjs.org/node-xmpp-core
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/ws
npm http 304 https://registry.npmjs.org/browser-request
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/md5.js
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/ws
npm http 304 https://registry.npmjs.org/node-xmpp-core
npm http 304 https://registry.npmjs.org/minimist
npm WARN engine [email protected]: wanted: {"node":">= 4"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm http GET https://registry.npmjs.org/hash-base
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/lodash.assign
npm http GET https://github.com/dodo/reconnect-core/tarball/merged
npm http GET https://registry.npmjs.org/node-xmpp-tls-connect
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/hash-base
npm http GET https://registry.npmjs.org/xmpp/jid
npm http GET https://registry.npmjs.org/xmpp/streamparser
npm http GET https://registry.npmjs.org/xmpp/xml
npm http 304 https://registry.npmjs.org/lodash.assign
npm http 304 https://registry.npmjs.org/node-xmpp-tls-connect
npm http GET https://registry.npmjs.org/ms/0.7.2
npm http GET https://registry.npmjs.org/aws-sign2
npm http GET https://registry.npmjs.org/aws4
npm http GET https://registry.npmjs.org/caseless
npm http GET https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/extend
npm http 304 https://registry.npmjs.org/ms/0.7.2
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/har-validator
npm http GET https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/http-signature
npm http 304 https://registry.npmjs.org/aws4
npm http GET https://registry.npmjs.org/is-typedarray
npm http GET https://registry.npmjs.org/isstream
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/mime-types
npm http GET https://registry.npmjs.org/ultron
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/performance-now
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/options
npm http GET https://registry.npmjs.org/stringstream
npm http GET https://registry.npmjs.org/safe-buffer
npm http GET https://registry.npmjs.org/tough-cookie
npm http GET https://registry.npmjs.org/tunnel-agent
npm http 304 https://registry.npmjs.org/caseless
npm http GET https://registry.npmjs.org/uuid
npm http 304 https://registry.npmjs.org/combined-stream
npm http 304 https://registry.npmjs.org/extend
npm http 304 https://registry.npmjs.org/forever-agent
npm http 304 https://registry.npmjs.org/aws-sign2
npm http 304 https://registry.npmjs.org/form-data
npm http 304 https://registry.npmjs.org/har-validator
npm http 304 https://registry.npmjs.org/hawk
npm http 304 https://registry.npmjs.org/http-signature
npm http 304 https://registry.npmjs.org/is-typedarray
npm http 304 https://registry.npmjs.org/isstream
npm http 304 https://registry.npmjs.org/json-stringify-safe
npm http 304 https://registry.npmjs.org/mime-types
npm http 304 https://registry.npmjs.org/ultron
npm http 304 https://registry.npmjs.org/oauth-sign
npm http 304 https://registry.npmjs.org/performance-now
npm http 304 https://registry.npmjs.org/options
npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/stringstream
npm http 304 https://registry.npmjs.org/safe-buffer
npm http 304 https://registry.npmjs.org/tough-cookie
npm http 304 https://registry.npmjs.org/tunnel-agent
npm http 304 https://registry.npmjs.org/uuid
npm WARN engine [email protected]: wanted: {"node":">= 0.12"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.32"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm http 404 https://registry.npmjs.org/xmpp/jid
npm http 404 https://registry.npmjs.org/xmpp/streamparser
npm ERR! TypeError: Cannot read property 'latest' of undefined
npm ERR! at next (/usr/local/lib/node_modules/npm/lib/cache.js:692:35)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:680:5
npm ERR! at saved (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save"
npm ERR! cwd /home/user/discord-xmpp
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! type non_object_property_load
npm http 404 https://registry.npmjs.org/xmpp/xml
npm ERR! TypeError: Cannot read property 'latest' of undefined
npm ERR! at next (/usr/local/lib/node_modules/npm/lib/cache.js:692:35)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:680:5
npm ERR! at saved (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save"
npm ERR! cwd /home/user/discord-xmpp
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! type non_object_property_load
npm ERR! TypeError: Cannot read property 'latest' of undefined
npm ERR! at next (/usr/local/lib/node_modules/npm/lib/cache.js:692:35)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:680:5
npm ERR! at saved (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save"
npm ERR! cwd /home/user/discord-xmpp
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! type non_object_property_load
npm http GET https://registry.npmjs.org/delayed-stream
npm http GET https://registry.npmjs.org/mime-db
npm http 304 https://registry.npmjs.org/delayed-stream
npm http 304 https://registry.npmjs.org/mime-db
npm http GET https://registry.npmjs.org/asynckit
npm http 304 https://registry.npmjs.org/asynckit
npm http GET https://registry.npmjs.org/assert-plus
npm http GET https://registry.npmjs.org/jsprim
npm http GET https://registry.npmjs.org/sshpk
npm http GET https://registry.npmjs.org/ajv
npm http GET https://registry.npmjs.org/har-schema
npm http 304 https://registry.npmjs.org/jsprim
npm http 304 https://registry.npmjs.org/assert-plus
npm http 304 https://registry.npmjs.org/sshpk
npm http 304 https://registry.npmjs.org/har-schema
npm http 304 https://registry.npmjs.org/ajv
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm http GET https://registry.npmjs.org/json-schema/0.2.3
npm http GET https://registry.npmjs.org/verror/1.3.6
npm http GET https://registry.npmjs.org/assert-plus/1.0.0
npm http GET https://registry.npmjs.org/extsprintf/1.0.2
npm http 304 https://registry.npmjs.org/json-schema/0.2.3
npm http 304 https://registry.npmjs.org/verror/1.3.6
npm http 304 https://registry.npmjs.org/assert-plus/1.0.0
npm http 304 https://registry.npmjs.org/extsprintf/1.0.2
npm http 200 https://github.com/dodo/reconnect-core/tarball/merged
npm http GET https://registry.npmjs.org/punycode
npm http 304 https://registry.npmjs.org/punycode
npm http GET https://registry.npmjs.org/pako
npm http GET https://registry.npmjs.org/superagent
npm http GET https://registry.npmjs.org/tweetnacl
npm http GET https://registry.npmjs.org/types/node
npm http 304 https://registry.npmjs.org/superagent
npm http 304 https://registry.npmjs.org/tweetnacl
npm http 304 https://registry.npmjs.org/pako
npm http GET https://registry.npmjs.org/asn1
npm http GET https://registry.npmjs.org/dashdash
npm http GET https://registry.npmjs.org/getpass
npm http GET https://registry.npmjs.org/jsbn
npm http GET https://registry.npmjs.org/hoek
npm http GET https://registry.npmjs.org/boom
npm http GET https://registry.npmjs.org/cryptiles
npm http GET https://registry.npmjs.org/sntp
npm http GET https://registry.npmjs.org/jodid25519
npm http GET https://registry.npmjs.org/bcrypt-pbkdf
npm http GET https://registry.npmjs.org/ecc-jsbn
npm http 304 https://registry.npmjs.org/asn1
npm http 304 https://registry.npmjs.org/hoek
npm http 304 https://registry.npmjs.org/dashdash
npm http 304 https://registry.npmjs.org/boom
npm http 304 https://registry.npmjs.org/getpass
npm http 304 https://registry.npmjs.org/sntp
npm http 304 https://registry.npmjs.org/cryptiles
npm http 304 https://registry.npmjs.org/jsbn
npm http 304 https://registry.npmjs.org/jodid25519
npm http 304 https://registry.npmjs.org/bcrypt-pbkdf
npm http 304 https://registry.npmjs.org/ecc-jsbn
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm WARN engine [email protected]: wanted: {"node":">=0.10.40"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm http 404 https://registry.npmjs.org/types/node
npm ERR! TypeError: Cannot read property 'latest' of undefined
npm ERR! at next (/usr/local/lib/node_modules/npm/lib/cache.js:692:35)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:680:5
npm ERR! at saved (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this entire log,
npm ERR! including the npm and node versions, at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save"
npm ERR! cwd /home/user/discord-xmpp
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! type non_object_property_load
npm http GET https://registry.npmjs.org/co
npm http GET https://registry.npmjs.org/json-stable-stringify
npm http 304 https://registry.npmjs.org/co
npm http 304 https://registry.npmjs.org/json-stable-stringify
npm WARN engine [email protected]: wanted: {"iojs":">= 1.0.0","node":">= 0.12.0"} (current: {"node":"v0.10.25","npm":"1.3.24"})
npm http GET https://registry.npmjs.org/jsonify
npm http 304 https://registry.npmjs.org/jsonify
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/user/discord-xmpp/npm-debug.log
npm ERR! not ok code 0
I use Debian 8 (amd64)
Could you add a function that will send every join message (xmpp) in another channel (discord) ?
...xmpp-discord/app.js:186
discord.channel.sendMessage(message);
^
TypeError: Cannot read property 'sendMessage' of undefined
at Client. (/app.js:186:19)
at emitOne (events.js:116:13)
at Client.emit (events.js:211:7)
at Client._handleStanza (/node_modules/node-xmpp-client/lib/Client.js:227:12)
at Client.onStanza (/node_modules/node-xmpp-client/lib/Client.js:221:8)
at emitOne (events.js:116:13)
at Connection.emit (events.js:211:7)
at Connection.onStanza (/node_modules/node-xmpp-core/lib/Connection.js:377:10)
at StreamParser. (/node_modules/node-xmpp-core/lib/Connection.js:231:10)
at emitOne (events.js:116:13)
Hello!
I'm trying to see if it's possible to allow a discord with multiple users in Champions Online (Shares XMPP like NeverWinter and Star Trek Online ) to be able to use this bot as well as myself. I'm not entirely sure how this all works, but I've managed to get far enough to try and input the correct credentials in the lines as directed. I use Xabber on my mobile and it works fine. I'm not entirely sure what i'm doing incorrect if I have everything exact from Pidgin as well, from my XMPP account name, host being crypticspace.com, room ID being typed: [email protected], port 5222. I used my in game account password, XMPP Password, and my Discord password, all returned the same way. May I ask for assistance please?
D:\Program Folder\Discord XMPP Bot\Discord bot>node app.js
(node:6680) [DEP0107] DeprecationWarning: tls.convertNPNProtocols() is deprecated.
Successfully connected to Discord.
Something went wrong with XMPP:
XMPP authentication failure
Hi,
Trying to use this as a read-only relay between the server here and a Discord server. The bot connects without issue, but after a minute or two throws this exception and crashes:
/home/calvin/discord-xmpp/app.js:181
discord.channel.sendMessage(message);
^
TypeError: Cannot read property 'sendMessage' of undefined
at Client.<anonymous> (/home/calvin/discord-xmpp/app.js:181:18)
at emitOne (events.js:96:13)
at Client.emit (events.js:188:7)
at Client._handleStanza (/home/calvin/discord-xmpp/node_modules/node-xmpp-client/lib/Client.js:227:12)
at Client.onStanza (/home/calvin/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/calvin/discord-xmpp/node_modules/node-xmpp-core/lib/Connection.js:377:10)
at StreamParser.<anonymous> (/home/calvin/discord-xmpp/node_modules/node-xmpp-core/lib/Connection.js:231:10)
at emitOne (events.js:96:13)
Am I doing something wrong here, or did I just unearth a bug?
Thanks for a useful script!
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 = '[email protected]';
const PASSWORD = 'mypassword';
const ROOM_JID = '[email protected]';
const HOST = 'fcon.us';
const PORT = 5222;
This might be something simple, but I am stuck in a completely different issue than the other post. This is what I'm getting:
root@server1:~/fconping/discord-xmpp# nodejs app.js
module.js:340
throw err;
^
Error: Cannot find module 'discord.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/root/fconping/discord-xmpp/app.js:14:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
I am currently attempting to monitor an XMPP account and relay all direct messages it receives from a particular user to a discord channel. Is that something that could be done using this repo? From what I have seen in the other issues threads, there appears to be some difficulty with single users as opposed to MUC's.
Discord servers have the ability for a person to set a nickname and show in said server. For example, my un is strangelyodd, but in one server, I have myself shown as strangelyraidur. Not sure how difficult it will be to add in this functionality, but it'd be nice.
Any ideas for me? I've got the relay running, the bot is online, and I can see messages going from discord to the xmpp channel, but when something is posted in the xmpp channel, it doesn't get posted in the discord channel.
I should note, I'm not getting any errors.
Just tried setting this up and had some issues. It probably doesn't help that I really don't know what I'm doing. Anyways.... I have everything setup, and I run the app.js As you see below it says that it connects fine to both Discord and the XMPP channel. But when we send messages from the Discord server, they do not go through. There's no error given, nothing happens. When we try to send messages from the XMPP server, they come through into Discord, but it gives the error you see below the Successfully connected messages. Each time I restart the app.js, it says the same thing but the node number changes. Any help would be greatly appreciated.
E:\RelayBot\discord-xmpp-master>node app.js
Successfully connected to XMPP chatroom '[email protected]'.
Successfully connected to Discord.
(node:30936) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'add' of undefined
EDIT: Ok here's what I figured out so far... I also couldn't get another outside program, Xabber on my Android phone, to connect to channels either. I would add them, but it would give me an authorization error, and just like with the relay, messages from the XMPP server come through fine, but nothing goes through from the app into the XMPP server. The only thing I changed to get it working in Xabber, was to set my nickname in the settings for the channel (Conference) to match my JID without the Servername after it. Then it worked right away, both ways. Is there anyway with your program here to set the name here? I tried to set the XMPP_Alias to it, but that didn't work either.
Hello,
Thanks in advance for the great app. While this is not a critical issue, the bot logs this:
(node:8883) DeprecationWarning: TextChannel#sendMessage: use TextChannel#send instead
Could you add a command (discord side) that will send the result of a whois.
Like if I send on discord /whois user it will reply with the result of whois (xmpp side)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.