Git Product home page Git Product logo

margarinebot's Introduction

MargarineBot

License Support Server

Dependencies

discord.js klasa node

A Discord bot coded in Node.js using the Discord.js Library and the Klasa framework.

As of January 3rd, 2023, MargarineBot is retired and no longer supported. Thanks for the six years of active use!

Introduction

MargarineBot is a multi-purpose Discord bot that ranges in features such as server moderation, to an economy system using a SQLite database, to starboards, and much more. MargarineBot also features highly customizable settings for your guild to personalize and maximize his potential in your server!

Created through part-desire, part-what can I do in Discord, part-I'm going to learn JavaScript, and part-it's only midnight thoughts, MargarineBot has been my personal project for several years now. For the amount of time and effort I've spent, I'm quite proud of my work and the functionality I've be able to pull off. Ever since the start of his development, I've received plenty of support and can't thank those people enough. As without it, Margarine would never be as big or as good as he is today. So, take a look... get some inspiration... just be sure to enjoy Margarine as much as I do.

Looking to invite me?

You can do so here! However, music is a self-hosted feature and is not present in the bot.

This project is retired as of January 3rd, 2023. Inviting is no longer possible.

Name Origin

My typical nickname is Butter, as in the stuff that you put on toast. His name comes from the artificial butter (I tends to call it 'Fake Butter') you can buy in stores called, Margarine.

License and Contact

MargarineBot is licensed under the Apache-2.0 License.

For issues and bugs, please use the issue tracker on this repository. For any other needs, either contact me by email [email protected] or through my Discord server in the #margarine-bot channel.

margarinebot's People

Contributors

aurelicbutter 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  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  avatar  avatar  avatar

margarinebot's Issues

Error in daily.js

There is an error in daily.js who's error is Can Not Define length of undefiend. #39 @Butterstroke

Member Join Crashes

Whenever a new member joins a server, it crashes Margarine. Might have something to do with stuff in the event.

MargarineBot Cannot Delete Files

Error: EPERM: operation not permitted, unlink 'c:\MargarineBot-master/node_modules/klasa/src/commands/General/Chat Bot Info'
at unlinkSync (fs.js:1251:3)
at c:\MargarineBot-master\utilities\utilExport.js:18:4
at Array.forEach ()
at exports.commandRemover (c:\MargarineBot-master\utilities\utilExport.js:17:28)
at Object. (c:\MargarineBot-master\index.js:40:1)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) {
errno: -4048,
syscall: 'unlink',
code: 'EPERM',
path: 'c:\MargarineBot-master/node_modules/klasa/src/commands/General/Chat Bot Info'
}

Rework guild configurations

This ties into #20 as if Margarine was to log actions via a channel, the guild conf would allow the admins to specify which channel it will be posted in.

Also, this will lead to much greater control over a few planned features later.

Komada v0.20 update

New version of Komada. Seems to break a lot of things. Try to update Komada for Beta 0.6.

Documentation

For general purposes regarding Margarine and his code. Not a major priority on the list however, it is always good to have a place for FAQs and general questions. Will also consist of a guide on how to self-host the code if the person so wishes to.

MargarineBot v2.0 Development

It's official! MargarineBot v2.0 is in development!

MargarineBot has outgrown some of its systems and has become a bit constricted in what it can support. Not to mention, the feature backlog is split 50:50 for these features and features that can still be added to v1. So, it is the perfect time to upgrade Margarine's systems!

With this update, I am hoping that the changes will bring a lot more flexibility and freedom when it comes to adding new features that need a bit of change. Nearly every aspect from databases to speech to user commands is on the table for change. But, hopefully, not too much change to alienate v1 from v2 and make v2 migrations difficult.

Planned Changes

I have a lot of ideas and work planned to happen for this release. Some items may come in future releases of v2 but this is a list of what to expect from v2.

Database management is getting a lot of updates in this update. A major priority with this update is to allow hosters to use a database provider of their choice via official plugin or self-made. Official support will include SQLite and Postgres but MongoDB & MySQL may also be included. On top of this, guild and client settings will be merged into the same database as MargarineUser profiles instead of a hybrid JSON/SQLite setup with v1.

MargarineUser profiles and capabilities are also getting a fair amount of priority. MargarineUsers can expect to have more 3rd-party services to connect to similar to AniList and MyAnimeList. The economy commands, one of the lesser developed modules in recent updates, will also be expanded to have more purpose and allow MargarineUsers to do more with their inventories and credits.

A new framework, Miyuu, is also in development specifically for Margarine to replace Klasa. Miyuu's repository is made public as of this announcement which you can view here: https://github.com/Butterstroke/Miyuu

Finally, here's a list of miscellaneous things I still wanted to highlight:

  • Restructure the speechHelper function to be more readable and more efficient.
  • Utilize TypeScript for development as opposed to JavaScript.

Roadmap

The current roadmap is planned to take a few months of development. So while dates are nice, it's too far into the future to give an accurate timeline of events. However, these are some of the things users can expect to see in the following months:

  • MargarineBot v1 will still be supported at least until the release of v2.
  • Development changes may get ported into v1 with no major changes (ie: bug fixes, standalone features)
  • v1 will continue to migrate out of Klasa as much as possible to make it less dependent on it. v1 will not port over to Miyuu.
  • Updates for deprecation and ending support for v1 will be made closer to v2 release
  • A guide and tools to update from v1 to v2 will be made and released for self-hosters

Updates will be distributed by comments on this post and on my Discord support server.

Questions?

Any questions about these changes? Questions can be asked in the following places:

Discord Server: https://discord.gg/qKfqsjW (In the margarine-bot channel)

Email: [email protected]

DB

Hii! Im looking for the DB, is ti missing? :S

Music command Error

Hi ! I'm new to discord.js and all that but i was testing your play command :

const yt = require("ytdl-core");

exports.run = async (client, msg) => {
  const handler = client.queue.get(msg.guild.id);
  if (!handler) { throw `Si tu veux rajouter des musiques, utilise : ${msg.guild.settings.prefix}queue [Youtube URL] :3`; }
  
  if (!msg.guild.voiceConnection) {
    await client.commands.get("join").run(client, msg);
    if (!msg.guild.voiceConnection) { return; }
    return this.run(client, msg);
  }

  if (handler.playing) { 
    if (msg.member.voiceConnection !== msg.guild.voiceConnection) { throw "Je joue dans un autre salon..."; }

    throw "Je joue déjà dans ton salon :D";
  } else { handler.playing = true; }
    
  (function play(song) {
    if (song === undefined) {
      return msg.channel.send("Toutes les musiques que tu as demandé ont été jouées. Je m'en vais D:").then(() => {
      handler.playing = false;
      return msg.member.voiceChannel.leave();
    });
  }
    
  msg.channel.send(`📻 Joue : **${song.title}** | À la demande de : ${song.requester}`).catch(err => client.emit("log", err, "error"));
  
  return msg.guild.voiceConnection.playStream(yt(song.url, { audioonly: true }), { passes: 2 })
    .on("end", () => { setTimeout(() => {
      handler.songs.shift();
      play(handler.songs[0]);
    }, 100); })
  
    .on("error", err => msg.channel.send(`error: ${err}`).then(() => {
      handler.songs.shift();
      play(handler.songs[0]);
    }));
  }(handler.songs[0]));
    
  return null;
};

I've translated some things in French because my bot is in French, i get the following error :

(node:13028) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
    at Object.exports.run (c:\Users\Ce Pc\Desktop\Ananas\Commands\play.js:4:32)
    at module.exports (c:\Users\Ce Pc\Desktop\Ananas\Events\message.js:25:9)
    at Client.emit (events.js:189:13)
    at MessageCreateHandler.handle (c:\Users\Ce Pc\Desktop\Ananas\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (c:\Users\Ce Pc\Desktop\Ananas\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:105:65)
    at WebSocketConnection.onPacket (c:\Users\Ce Pc\Desktop\Ananas\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (c:\Users\Ce Pc\Desktop\Ananas\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (c:\Users\Ce Pc\Desktop\Ananas\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:189:13)
    at Receiver.receiverOnMessage (c:\Users\Ce Pc\Desktop\Ananas\node_modules\ws\lib\websocket.js:789:20)
    at Receiver.emit (events.js:189:13)
    at Receiver.dataMessage (c:\Users\Ce Pc\Desktop\Ananas\node_modules\ws\lib\receiver.js:422:14)
    at Receiver.getData (c:\Users\Ce Pc\Desktop\Ananas\node_modules\ws\lib\receiver.js:352:17)
    at Receiver.startLoop (c:\Users\Ce Pc\Desktop\Ananas\node_modules\ws\lib\receiver.js:138:22)
    at Receiver._write (c:\Users\Ce Pc\Desktop\Ananas\node_modules\ws\lib\receiver.js:74:10)
    at doWrite (_stream_writable.js:410:12)

I've asked on github of ytdl-core, they tell me : this issue tracker is mainly for tracking ytdl-core errors. and since this error is not coming from ytdl-core
Thanks :D

Why is this issue coming up?

internal/util.js:260
throw new ERR_INVALID_ARG_TYPE('original', 'Function', original);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type Function. Received type undefined
←[90m at promisify (internal/util.js:260:11)←[39m
at Object. (D:\Bot\MargarineBot-Release-1.0\node_modules\←[4mfs-nextra←[24m\src\fs.js:6:41)
←[90m at Module._compile (internal/modules/cjs/loader.js:956:30)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:812:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:724:14)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:849:19)←[39m
←[90m at require (internal/modules/cjs/helpers.js:74:18)←[39m
at Object. (D:\Bot\MargarineBot-Release-1.0\node_modules\←[4mfs-nextra←[24m\src\util.js:6:129)
←[90m at Module._compile (internal/modules/cjs/loader.js:956:30)←[39m {
code: ←[32m'ERR_INVALID_ARG_TYPE'←[39m
}

Issues with the prefix

When I set the prefix in settings.json, I say -help and it responds with Whoops! Looks like you are thinking of my default prefix. That is not the case here. Please use: <PREFIX>

How to set bot activity

so i have digged every where and am unable to find out HOW TO SET THE BOT ACTIVITY, or if there is a code already WHERE IS IT

Aaaaaaaaaaaaaa

MargarineBot Changes and Road Map

It's been a while since I've communicated my findings with what's been happening with Margarine. I think this is the best way to answer any questions and have a bit of a road map of what to expect in the future.

Problem:
As reported on October 20th (#51), Margarine's dependencies conflicted with Node 10+, the new stable version of Node. While downgrading to Node 8 would be fine, the version of Discord.js that Margarine uses had moved on and is only available for Node 10+. In doing so, the framework package, Komada, which breaks in Node 10 now leaves Margarine unable to run.

Unfortunately, Komada has proven to be a real challenge in trying to get it up to speed and running on Node 10+. Alongside this issue, the sqlite3 package was also proving difficulties in installing on systems.

What's Next:
As of today, MargarineBot will be switching from the Komada framework to the Klasa framework. This will not be a small change or a fix. This is going to be a whole rewrite of Margarine!!!

By switching frameworks, Margarine moves to a more active framework that is supported on the current versions of Node.js. This will be a significant switch from Margarine's current state and will probably involve a vast amount of work. As the code is migrating to the new framework, here is what I'm expecting is going to happen. This is to change given on the size of the rewrite.

  • Release-1.0 branch will not be expecting any updates as of today. All work for it is migrating to the rewrite.
  • A Klasa prototype is expected to be out by December 25th, 2019 at the latest! This will not contain all features of Margarine but will expand as development continues.
  • All self-hosted bots with Komada will be supported until December 31st, 2019! Afterwards, you'll have to switch to Klasa for continued support.
  • This rewrite is expected to be completed in late January 2020.

I'm not expecting to preserve any data from switching the frameworks and many of the economy commands have already been updated and changed from their current state in efforts to fix the sqlite3 issues.

Questions?
Any questions about these changes? Questions can be asked in the following places:

Discord DMs: Butterstroke#7150
Discord Server: https://discord.gg/TJJ6KGd (In the margarine-bot channel)
Email: [email protected]

Edit: Added a mention about Release-1.0 branch.

Error Upon Running Help Command

2020-03-02 07:21:47] at module.exports.run (/app/commands/General/help.js:23:16)
[2020-03-02 07:21:47] at process._tickCallback (internal/process/next_tick.js:68:7)

Anime/Manga Searches

Search for anime and manga through commands.

Checklist:

  • Anime search command
  • Manga search command
  • Search for a user's MAL profile (Suggested by a user) | [Completed and added to Beta 0.9]
  • Search for a user's AniList profile. | [Completed and added to Release 1.0]
  • Link your MAL/AniList username with your data in Margarine
  • MAL profile searches error currently due to maintenance [MAL profiles are now available]

Not really an issue more ... Talking? Idk how to contact you lol

I am not the only one who cannot find hydrabolt.


ERROR 404 Not Found: 
https://codeload.github.com/hydrabolt/discord.js/tar.gz/d92ee2ff999954899c891c093f5f107dd686b64f```

![image](https://user-images.githubusercontent.com/38189579/49347300-29526780-f66b-11e8-9e24-2ed596a40a8c.png)

This appears to actually be a common issue now that I look around more ...

New Server Message Issue

When joining a server, Margarine doesn't post a message to any channel, yet, he doesn't crash.

Command Handler

Hey, This happens not to be an issue, more like a question. How did you setup your command handler to allow your main index.js file to locate your commands folder and then find the command folders within the commands folder? So basically how did you setup multiple command folders?

Bot Logging Mod Actions

Currently, Margarine gets an ID of a mod-log channel and then targets that one channel no matter which server the command is run on.

Perhaps, the mod log could be internal to reduce channels on guilds. Also, include a DM to the user about the command action.

How will storing the user ID go if the bot has no permission to store the data?

UPDATE (Hopefully for Beta 0.9!):

  • Finally do Guild Configurations
  • Add configuration for moderation log

Playing Music Error

Server keeps skipping the song when it is defined. However, same code on the local machine does not have any issues with it and plays the song.

Error: Closed before connection is established.

All packages have gotten a fresh install.

i need help asap!

i did /money
and it said 'That person hasn't signed up with m~daily yet! D:'
how to signup?

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.