Git Product home page Git Product logo

discord-bot's Introduction

Modular Discord Bot

A Bot for Discord, written in PHP.

The main goal was modularity, which enables it to easily be split into independently installable plugins.

Requirements

Quickstart

The following snippet is all that is required to run the basic bot with the default plugins.

$bot = new SunflowerFuchs\DiscordBot\Bot([
    'token' => 'XXXXX'
]);
$bot->run();

Other features can easily be added to the Bot by just adding more plugins, like for example the TikTok Plugin.

$bot = new SunflowerFuchs\DiscordBot\Bot($options);
$bot->registerPlugin(new TiktokPlugin());
$bot->run();

discord-bot's People

Contributors

sunflowerfuchs avatar

Stargazers

 avatar

Watchers

 avatar

discord-bot's Issues

Implement Guild object

Not sure why, but it seems I've forgotten to implement the Guild object.
See the discord api docs for more info.

P.s.: I should probably verify that all other objects are implemented.

Implement bot command permission system

Minimum, we need a 2 level permission system (regular user + admin), possibly more flexible though.

First thoughts right now:

  • Global admin
    • Highly restricted high-level functionality that we could expose, like bot restarts/reloads
    • how declared? editable at runtime? or static and defined in the config?
  • Per-Server admin
    • less critical functionality, important for plugins
  • Extensible?
    • Would allow plugins to create their own permission levels if needed, instead of being restricted to the 2/3 we decide to start with

Implement data storage

We need a simple data storage management.
There's two types of data that needs to be stored:

  • Bot data
  • Per-Plugin data

Implement sharding

Sharding isn't yet implemented, and it would be good to have if the bot should be able to run on many servers at once.

Write basic documentation

We should have a simple documentation for the following things:

  • How to launch the bot
  • What options the bot takes
  • How to write a plugin

Permission requirement system

Some functionality requires specific permission of the bot.
The permissions get first set when the bot gets invited to a server, so we need to define the permissions as early as possible.
Easiest way would be a public static const PERMISSION_REQUIREMENTS = (int) for every plugin, and then the bot gets a getPermissionRequirements():int function to use for the invite link.

Implement DMs

Immediate thoughts:

  • The bot should be able to react to things sent to it via dm.
  • Plugins should be able to:

Improve error handling

Currently. if e.g. User::loadById() fails (due to e.g. a network error), it will cause a hard crash. We should probably improve error handling enough that an error within a plugin doesn't crash the entire bot.

Generate invite links

The bot should have a simple function to generate the links needed to invite it to servers.
Either:

  • Show during boot
  • Be available via plugin command

Implement help command

We need a help command.
It should probably look like this:

help [function]

Without a parameter, it lists all (currently available) commands.
With a parameter, it returns extended information for the given command, if available.

Clean up constructors

The constructors should use named arguments instead of accepting an array, and instead all objects should gain a static ::fromData() method that just calls the constructor.
That way we can actually construct elements without having to memorize the array structure, while keeping it easy to deal with api responses.

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.