Giter Club home page Giter Club logo

sheffield-discord-bot's People

Contributors

benzene789 avatar dependabot[bot] avatar felixrandle avatar robbai avatar williamwflee avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sheffield-discord-bot's Issues

refactor: utils

utils.py steadily expanded as more cogs have been developed, so I believe that it should be reorganised into submodules.

Create Server Setting Table

Database

2 Tables

Settings
Int, String, String
Id, Identifier, DefaultValue

GuildSettings
Id, GuildId, SettingId, Value

Code

Needs a public interface so cogs can register settings for themselves
e.g.
register_setting("christmasMode", "false")

When pulling a setting, if no entry for the guild, use default value.
GuildSettings entry only exists once it has been explicitly set.

Error thrown in voice activity

4|Discord  | Traceback (most recent call last):
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/connections/connection.py", line 32, in _run
4|Discord  |     result = wrapped(self, query, bindings, *args, **kwargs)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/connections/connection.py", line 265, in statement
4|Discord  |     return self._new_cursor().execute(query, bindings)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/MySQLdb/cursors.py", line 209, in execute
4|Discord  |     res = self._query(query)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/MySQLdb/cursors.py", line 315, in _query
4|Discord  |     db.query(q)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/MySQLdb/connections.py", line 239, in query
4|Discord  |     _mysql.connection.query(self, query)
4|Discord  | MySQLdb._exceptions.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`sheffieldcompsci`.`voice`, CONSTRAINT `voice_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`))')
4|Discord  |
4|Discord  | During handling of the above exception, another exception occurred:
4|Discord  |
4|Discord  | Traceback (most recent call last):
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/discord/ext/tasks/__init__.py", line 120, in _loop
4|Discord  |     raise exc
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/discord/ext/tasks/__init__.py", line 98, in _loop
4|Discord  |     await self.coro(*args, **kwargs)
4|Discord  |   File "/data/Sheffield-Discord-Bot/cogs/logging.py", line 140, in voice_channel_check
4|Discord  |     guild_id=guild.id)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 461, in first_or_create
4|Discord  |     return cls.create(**attributes)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 422, in create
4|Discord  |     model.save()
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 1630, in save
4|Discord  |     saved = self._perform_insert(query, options)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 1701, in _perform_insert
4|Discord  |     self._insert_and_set_id(query, attributes)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 1723, in _insert_and_set_id
4|Discord  |     id = query.insert_get_id(attributes, key_name)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/orm/builder.py", line 1179, in call
4|Discord  |     result = attribute(*args, **kwargs)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/query/builder.py", line 1400, in insert_get_id
4|Discord  |     return self._processor.process_insert_get_id(self, sql, values, sequence)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/query/processors/mysql_processor.py", line 28, in process_insert_get_id
4|Discord  |     query.get_connection().insert(sql, values)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/connections/connection.py", line 250, in insert
4|Discord  |     return self.statement(query, bindings)
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/connections/connection.py", line 35, in _run
4|Discord  |     e, query, bindings, wrapped
4|Discord  |   File "/usr/local/lib/python3.6/dist-packages/orator/connections/connection.py", line 357, in _try_again_if_caused_by_lost_connection
4|Discord  |     raise QueryException(query, bindings, e)
4|Discord  | orator.exceptions.query.QueryException: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`sheffieldcompsci`.`voice`, CONSTRAINT `voice_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`))') (SQL: INSERT INTO `voice` (`guild_id`, `user_id`) VALUES (%s, %s) ([612377874787336212, 234395307759108106]))

feat: birthdays

Allows users to add their birthday to the bot so that the bot celebrates their birthday

stats: merge messages

Modification to the $channelSummary command that lets the user merge messages so that multiple messages over a short period of time show up as a single single message so text spam influences the stats less.

This could be done using a flag on the command or just a new command, honestly I don't know what's possible.

chore: migrate ORM from Orator to Masonite

Orator was selected the ORM for this project for its simple design and syntax. Unfortunately, Orator never made it to a full release, and while the core of the framework worked, there were some workarounds that were needed for a small number of edge cases, mostly with migrations.

Masonite has been developed as an almost direct drop-in replacement for Orator, and is now in stable release.

Error thrown in Polls Cog

4|Discord  | Exception in callback PollsCog.after_poll_daemon_end(<Task cancell...init__.py:88>>)
4|Discord  | handle: <Handle PollsCog.after_poll_daemon_end(<Task cancell...init__.py:88>>)>
4|Discord  | Traceback (most recent call last):
4|Discord  |   File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
4|Discord  |     self._callback(*self._args)
4|Discord  |   File "/data/Sheffield-Discord-Bot/cogs/polls.py", line 406, in after_poll_daemon_end
4|Discord  |     error = fut.exception()
4|Discord  | concurrent.futures._base.CancelledError

Unable to DM joining users

Looks like this method wasn't triggered when I (r0bbi3#0269) joined.
This is likely caused by this setting being disabled.
This has left me with 0 roles in the server, and therefore no access to the rest of the server.
Perhaps it's better to place the lines of code that direct message the user in a try-except block, so the method doesn't throw an error before giving the user their "registering" role.

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.