Coder Social home page Coder Social logo

ultrabot's People

Contributors

j-holub avatar phschon avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

ultrabot's Issues

Create a module system

As noted by @00steinsgate00 in #1, a module system which is able to load arbitrary modules from a module directory would be noice.

Suggested architecture:

  • Create a generic baseclass for plugins. Not sure on python best practices, but as far as I understand it, you define all methods you want and just throw NotImplementedErrors. We probably need

    • prefix() - the prefix part of the command. E.g. 'swag' or 'random'
    • help() - return a help message
    • execute(args) - execute a command where args are the parameters excluding the prefix, e.g. '2d6'
  • At startup, scan all files in modules/ for python files. For each matching file, load it dynamically. See here for sample code

  • On each module loaded that way, call some predefined method (e.g. initialize()) which should return an object implementing the ABC from above

  • The plugin can then be registered internally

Howlong bug

@00steinsgate00
Entering !howlong tomb raider yields the following stack trace:

future: <Task finished coro=<Howlongtobeat.execute() done, defined at /home/elazar/discordbot/plugins/howlongtobeat.py:33> exception=HTTPException('BAD REQUEST (status code: 400)',)>
Traceback (most recent call last):
File "/home/elazar/discordbot/plugins/howlongtobeat.py", line 63, in execute
await self.client.send_message(message.channel, response_message)
File "/home/elazar/discordbot/env/lib/python3.6/site-packages/discord/client.py", line 1152, in send_message
data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
File "/home/elazar/discordbot/env/lib/python3.6/site-packages/discord/http.py", line 200, in request
raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)

Better Documentation

Especially now since the new methods have been added I think we need some more documentation.

I tried to figure out how to use the event system and I couldn't, the code is just a bunch of methods with no comments

bildschirmfoto 2018-03-15 um 13 34 57

I have no idea what I have to do actually.

Furthermore I think we should document the base class and what the methods are for. I know there is an example template but it's better to have some proper documentation. Plus the template does not call the super constructor which is very very bad practice in my opinion.

Unnecessary use of 'await'?

I see that the main bot loop uses await a lot when sending messages. Is this really necessary? I assume the bot would run a bit smoother if dropping it.

pr0gram plugin error

@00steinsgate00 , I think your Plugin behaves not as intended. When using commands like !pr0 epic_mount the bot does not yield any output on a discord channel.

On the console the following error is displayed:
Task exception was never retrieved future: <Task finished coro=<pr0gramm.execute() done, defined at /home/elazar/discordbot/plugins/image_post.py:31> exception=IndexError('list index out of range',)> Traceback (most recent call last): File "/home/elazar/discordbot/plugins/image_post.py", line 33, in execute random_item = self._getRandomItem(command) File "/home/elazar/discordbot/plugins/image_post.py", line 63, in _getRandomItem return items[random.randint(0, len(items))] IndexError: list index out of range

Port to rust

Because SUCH SPEED much safety wow

Rust is our lord and savior

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.