A maubot that tracks the karma of users.
maubot / karma Goto Github PK
View Code? Open in Web Editor NEWA maubot plugin to track the karma of users
License: GNU Affero General Public License v3.0
A maubot plugin to track the karma of users
License: GNU Affero General Public License v3.0
A maubot that tracks the karma of users.
Will be good to have way for limit room list, where bot counts user karma. Because now user can invite bot to new room (or many rooms) with his second account, and increase his karma manually.
At now maubot karma allow to talk with it only publicly in room, so if user want to lookup some info (eg his karma rate or top rating), it will always spam all other room members.
As alternative way, will be good to have commands for direct talking user with bot in private room (user+bot) to receive stats from needed room, eg:
!karma #[email protected] top
!karma [email protected] top
17:16:05 ERROR instance/maubot.karma Failed to start instance
17:16:05 ERROR instance/maubot.karma Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
return fn()
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 364, in connect
return _ConnectionFairy._checkout(self)
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
rec = pool._do_get()
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 241, in _do_get
return self._create_connection()
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
return _ConnectionRecord(self)
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
self.__connect(first_connect_check=True)
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 661, in __connect
pool.logger.debug("Error on connect(): %s", e)
File "/usr/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.raise_(
File "/usr/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
connection = pool._invoke_creator(self)
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
return dialect.connect(*cargs, **cparams)
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 508, in connect
return self.dbapi.connect(*cargs, **cparams)
sqlite3.OperationalError: unable to open database file
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/maubot/maubot/instance.py", line 370, in start
await self.plugin.internal_start()
File "/opt/maubot/maubot/plugin_base.py", line 105, in internal_start
await self.start()
File "/data/plugins/xyz.maubot.karma-v1.0.1.mbp/karma/bot.py", line 66, in start
self.karma_t, self.version = make_tables(self.database)
File "/data/plugins/xyz.maubot.karma-v1.0.1.mbp/karma/db.py", line 221, in make_tables
base.metadata.create_all()
File "/usr/lib/python3.9/site-packages/sqlalchemy/sql/schema.py", line 4664, in create_all
bind._run_visitor(
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2094, in _run_visitor
with self._optional_conn_ctx_manager(connection) as conn:
File "/usr/lib/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2086, in _optional_conn_ctx_manager
with self._contextual_connect() as conn:
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2302, in _contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2339, in _wrap_pool_connect
Connection._handle_dbapi_exception_noconnection(
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1583, in _handle_dbapi_exception_noconnection
util.raise_(
File "/usr/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2336, in _wrap_pool_connect
return fn()
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 364, in connect
return _ConnectionFairy._checkout(self)
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 778, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 495, in checkout
rec = pool._do_get()
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 241, in _do_get
return self._create_connection()
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 309, in _create_connection
return _ConnectionRecord(self)
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 440, in __init__
self.__connect(first_connect_check=True)
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 661, in __connect
pool.logger.debug("Error on connect(): %s", e)
File "/usr/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__
compat.raise_(
File "/usr/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
raise exception
File "/usr/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
connection = pool._invoke_creator(self)
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
return dialect.connect(*cargs, **cparams)
File "/usr/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 508, in connect
return self.dbapi.connect(*cargs, **cparams)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
(Background on this error at: http://sqlalche.me/e/13/e3q8)
Hello!
I recently installed maubot and tried to reverse-engineer Karma to hopefully make my own bots,
but when I used a "!karma up" as a reply, nothing seemed to happen, and the log only said
[2019-03-21 22:09:13,403] [[email protected].@niacdobot413:matrix.org] Failed to run handler
Traceback (most recent call last):
File "/path/to/maubot-venv/lib/python3.6/site-packages/mautrix/client/client.py", line 108, in call_handlers
await handler(event)
File "/path/to/maubot-venv/lib/python3.6/site-packages/maubot/handlers/command.py", line 85, in __call__
ok, res = await self.__call_subcommand__(evt, call_args, remaining_val)
File "/path/to/maubot-venv/lib/python3.6/site-packages/maubot/handlers/command.py", line 102, in __call_subcommand__
remaining_val=remaining_val)
File "/path/to/maubot-venv/lib/python3.6/site-packages/maubot/handlers/command.py", line 94, in __call__
return await self.__mb_func__(evt, **call_args)
TypeError: upvote() missing 1 required positional argument: 'evt'
I was using a fresh version of Karma (76f65eb), with a python 3.6 virtualenv, and the PyPI version of maubot (maubot 0.1.0.dev15)
(on ubuntu 18.04 if this is of any relevance)
Thanks in advance, and I hope I don't bother you too much with this, if the problem is on my part.
Have a nice day
eg: +100
maubot | [2018-11-07 10:22:27,923] [[email protected].@karma:maunium.net] Failed to run handler
maubot | Traceback (most recent call last):
maubot | File "/usr/lib/python3.6/site-packages/mautrix/client/client.py", line 104, in call_handlers
maubot | await handler(event)
maubot | File "/opt/maubot/maubot/matrix.py", line 91, in _command_event_handler
maubot | await self._trigger_command(command, evt)
maubot | File "/opt/maubot/maubot/matrix.py", line 96, in _trigger_command
maubot | await handler(evt)
maubot | File "/data/plugins/karma.mbp/karma/bot.py", line 156, in vote
maubot | content=self.parse_content(karma_target))
maubot | File "/data/plugins/karma.mbp/karma/bot.py", line 120, in parse_content
maubot | return f"[{name}]({self.client.get_download_url(evt.content.url)})"
maubot | AttributeError: 'MaubotMatrixClient' object has no attribute 'get_download_url'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.