Giter Club home page Giter Club logo

botkit-discord's Introduction

Howdy, I'm Brandon ๐Ÿ‘‹๐Ÿผ



Hi I'm Brandon Him, a self-taught developer currently living in Philadelphia, but professionally, I'm a solutions engineer at @apollographql, where I help large organizations learn and leverage the supergraph. Honestly, I used to be quite active on Github (achieved over a 1M+ downloads on my projects!), but now I tend to dabble on things I find interesting.

While I try my best to maintain all of my open-source repositories, all it takes is a star and a follow to give me a little motivation :).

If you are working on some cool stuff, feel free to shoot me an email, and let's connect.

You can catch my shinnagians on ๐Ÿ“น YouTube.


Github Stats

botkit-discord's People

Contributors

brh55 avatar dependabot[bot] avatar joemcmahon avatar yannzerookie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

botkit-discord's Issues

'ambient' not working

using the ambient setting on .hears() produces no results.

demo code (adapted from the glitch starterkit)

  controller.hears('!test', ['ambient'], (bot, message) => {
    
    let response = "test success!"
        bot.reply(message, response);

  });

replies to itself

The bot replies to messages that it writes
example

const discordBot = BotkitDiscord(config);

discordBot.hears('hello','direct_message',(bot, message) => {
    bot.reply(message, 'hello');
});

if you write "hello" to it it will just say hello over and over.
also the receive middlewares also get called for messages the bot sends

Looking for Maintainers

I'm busy with new things in my life, and would love to assign a few maintainers to the project. Please let me know if you are interested.

Occasional exceptions in isMention when message.text is uninitialized

Symptom: entries in the log similar to the following:

An error occurred in the categorize middleware:  TypeError: Cannot read property 'indexOf' of undefined
    at isMention (/home/jmcmahon/spud/node_modules/botkit-discord/middleware/categorize.js:1:52)
    at categorize (/home/jmcmahon/spud/node_modules/botkit-discord/middleware/categorize.js:21:6)
    at Ware.module.exports.handler (/home/jmcmahon/spud/node_modules/botkit-discord/middleware/categorize.js:33:2)
    at Ware.<anonymous> (/home/jmcmahon/spud/node_modules/wrap-fn/index.js:45:19)
    at next (/home/jmcmahon/spud/node_modules/ware/lib/index.js:85:20)
    at Ware.run (/home/jmcmahon/spud/node_modules/ware/lib/index.js:88:3)
    at Object.Botkit.botkit.categorize (/home/jmcmahon/spud/node_modules/botkit/lib/CoreBot.js:118:38)
    at /home/jmcmahon/spud/node_modules/botkit/lib/CoreBot.js:112:20
    at next (/home/jmcmahon/spud/node_modules/ware/lib/index.js:82:27)
    at /home/jmcmahon/spud/node_modules/wrap-fn/index.js:121:18

PR #21 fixes this.

Discord.js Update

Was wondering if there was any plans to update Discord.js to version 12. Botkit is on 11.

I don't understand what I'm doing wrong

It sounds stupid, but I can't do this, every time I try to download the Botkit-Discord npm "modules" it always fails, and I don't understand why. And that's it, I'm looking for assistance in using this or clarification on what I'm doing wrong, sorry for the inconvenience.

[installation] Minimal version of Node/npm ? Failures when installing

Hi,
What is the minimal version required of NodeJS and npm? I am using the LTS 10.16.0 version of Node (npm 6.9.0) and I get tons of problems with ffmpeg when doing:
npm install git+ssh://[email protected]/brh55/botkit-discord.git:

npm WARN deprecated [email protected]: ffmpeg-binaries is no longer being maintained. use ffmpeg-static, or just install ffmpeg
npm WARN deprecated [email protected]: New code is available at github.com/uNetworking/uWebSockets.js
npm WARN deprecated [email protected]: use node-fetch instead

> [email protected] install /var/www/lsd/bot/node_modules/lzma-native
> node-pre-gyp install --fallback-to-build && node node_modules/rimraf/bin.js build

[lzma-native] Success: "/var/www/lsd/bot/node_modules/lzma-native/binding-v3.0.8-node-v64-linux-x64/lzma_native.node" is installed via remote

> [email protected] install /var/www/lsd/bot/node_modules/erlpack
> node-gyp rebuild

make: Entering directory '/var/www/lsd/bot/node_modules/erlpack/build'
  CC(target) Release/obj.target/zlib/vendor/zlib/adler32.o
  CC(target) Release/obj.target/zlib/vendor/zlib/compress.o
  CC(target) Release/obj.target/zlib/vendor/zlib/crc32.o
  CC(target) Release/obj.target/zlib/vendor/zlib/deflate.o
  CC(target) Release/obj.target/zlib/vendor/zlib/gzclose.o
  CC(target) Release/obj.target/zlib/vendor/zlib/gzlib.o
  CC(target) Release/obj.target/zlib/vendor/zlib/gzread.o
  CC(target) Release/obj.target/zlib/vendor/zlib/gzwrite.o
  CC(target) Release/obj.target/zlib/vendor/zlib/infback.o
  CC(target) Release/obj.target/zlib/vendor/zlib/inffast.o
  CC(target) Release/obj.target/zlib/vendor/zlib/inflate.o
  CC(target) Release/obj.target/zlib/vendor/zlib/inftrees.o
  CC(target) Release/obj.target/zlib/vendor/zlib/trees.o
  CC(target) Release/obj.target/zlib/vendor/zlib/uncompr.o
  CC(target) Release/obj.target/zlib/vendor/zlib/zutil.o
  AR(target) Release/obj.target/vendor/zlib.a
  COPY Release/zlib.a
  CXX(target) Release/obj.target/erlpack/js/erlpack.o
In file included from ../js/erlpack.cc:2:0:
../js/encoder.h: In member function 'int Encoder::pack(v8::Local<v8::Value>, int)':
../js/encoder.h:58:44: warning: 'int32_t v8::Value::Int32Value() const' is deprecated (declared at /home/deploy/.node-gyp/10.16.0/include/node/v8.h:2478): Use maybe version [-Wdeprecated-declarations]
             int number = value->Int32Value();
                                            ^
../js/encoder.h:67:68: warning: 'uint32_t v8::Value::Uint32Value() const' is deprecated (declared at /home/deploy/.node-gyp/10.16.0/include/node/v8.h:2477): Use maybe version [-Wdeprecated-declarations]
                 auto uNum = (unsigned long long)value->Uint32Value();
                                                                    ^
../js/encoder.h:72:49: warning: 'double v8::Value::NumberValue() const' is deprecated (declared at /home/deploy/.node-gyp/10.16.0/include/node/v8.h:2475): Use maybe version [-Wdeprecated-declarations]
             double decimal = value->NumberValue();
                                                 ^
  SOLINK_MODULE(target) Release/obj.target/erlpack.node
  COPY Release/erlpack.node
make: Leaving directory '/var/www/lsd/bot/node_modules/erlpack/build'

> [email protected] install /var/www/lsd/bot/node_modules/ffmpeg-binaries
> node install

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND johnvansickle.com johnvansickle.com:443
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
Emitted 'error' event at:
    at TLSSocket.socketErrorListener (_http_client.js:392:9)
    at TLSSocket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm WARN [email protected] requires a peer of bufferutil@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/deploy/.npm/_logs/2019-06-01T11_53_57_020Z-debug.log

Abstract a custom event for MOTD / New Comers

Currently, there isn't an easy way to trigger events for new users joining the guild / server (other than the discord.js way). But because this is so commonly used, I think this is important to add an abstraction which includes some basic APIs and use cases.

For example, moving users to a private room, and allowing them to accept Terms of Agreements.

Bug: cannot reply to direct_message messages

Hello,

First of all, I'd like to tell you how much happy I was to find someone putting together BotKit and Discord. I am very excited!

I started playing with your code, and I think I spotted something fishy in bot.js, that makes the bot.reply method fail for messages of type direct_message. Consider this, from lines 27 to 36:

		if (src.type === 'direct_mention') {
			message.to = src.author.id;
		}

		if (
			src.type === 'mention' ||
			src.type === 'direct_mention'	
		) {
			message.to = src.channelId;
		}

I believe the second test of src.type === 'direct_mention' is wrong, and should be:

		if (
			src.type === 'mention' ||
			src.type === 'direct_message'	
		) {...

Otherwise you won't be able to reply to messages of type direct_message.

Do you welcome Pull Requests? Be advised that this is my first Node.js project - you have been warned ;)

Keep up the great work!

Area of Improvements in Docs

Would like to improve the documentation a little further, areas of improvement:

  • More examples and details with links to discord.js counterparts under each section
    • RichEmbed
    • Attachments
    • Text / DM (Need this still)
    • Voice
  • Add more real use examples, especially robust ones
  • Show case more examples/recipes for different events available to listen on

Migration to Discord.js

While the currently Discord library is light-weight, Discord.js is constantly being updated and supports rich-presences which would be ideal for a discord bot.

BOT status

How can i set my bot status?
Can I use (Bot.user.setStatus) and (Bot.user.setPresence) which are same as discord.js in botkit-discord ?

Optional FFMPEG Binary download

Allow users to download their own ffmpeg binary dependency. This needs some further testing, but we may be able to accomplish this with through peer dependencies. This will require some conditionals to raise an exception when it's not present, but users intend to use the voice features.

Project does not install anymore (erlpack issue), need update - help!

When I npm install, I am getting an error about erlpack. I believe this is because the project depends on a forked version of discord/erlpack : hammerandchisel/erlpack that is probably not up-to-date. Also see discord/erlpack#34

$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/erlpack
npm ERR!   erlpack@"github:hammerandchisel/erlpack" from [email protected]
npm ERR!   node_modules/botkit-discord
npm ERR!     botkit-discord@"^0.1.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional erlpack@"discordapp/erlpack" from [email protected]
npm ERR! node_modules/discord.js
npm ERR!   discord.js@"^11.4.2" from [email protected]
npm ERR!   node_modules/botkit-discord
npm ERR!     botkit-discord@"^0.1.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/yann/.npm/eresolve-report.txt for a full report.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.