-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Przemysław Romanik | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
# maubot-alternatingcaps | ||
# maubot-alternatingcaps | ||
|
||
A simple [maubot](https://github.com/maubot/maubot) plugin that repeats previous message in room using aLtErNaTiNg cApS. | ||
|
||
![preview](preview.png) | ||
|
||
## Usage | ||
|
||
Download .mbp from [releases](https://github.com/rom4nik/maubot-alternatingcaps/releases), [upload it](https://docs.mau.fi/maubot/usage/basic.html#uploading-plugins) to server, [create an instance](https://docs.mau.fi/maubot/usage/basic.html#creating-instances), send some message in a room with bot present, then send `!altcaps`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from maubot import Plugin, MessageEvent | ||
from maubot.handlers import command, event | ||
from mautrix.types import EventType | ||
|
||
|
||
class AlternatingCaps(Plugin): | ||
last_message = None | ||
|
||
@event.on(EventType.ROOM_MESSAGE) | ||
async def message_handler(self, evt: MessageEvent) -> None: | ||
self.last_message = evt.content.body | ||
|
||
@command.new() | ||
async def altcaps(self, evt: MessageEvent) -> None: | ||
if self.last_message: | ||
await evt.respond("".join([c.upper() if i % 2 else c.lower() for i, c in enumerate(self.last_message)])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# The unique ID for the plugin. Java package naming style. (i.e. use your own domain, not xyz.maubot) | ||
id: pl.rom4nik.maubot.alternatingcaps | ||
|
||
# A PEP 440 compliant version string. | ||
version: 0.1.0 | ||
|
||
# The SPDX license identifier for the plugin. https://spdx.org/licenses/ | ||
# Optional, assumes all rights reserved if omitted. | ||
|
||
license: MIT | ||
|
||
|
||
# The list of modules to load from the plugin archive. | ||
# Modules can be directories with an __init__.py file or simply python files. | ||
# Submodules that are imported by modules listed here don't need to be listed separately. | ||
# However, top-level modules must always be listed even if they're imported by other modules. | ||
modules: | ||
- alternatingcaps | ||
|
||
# The main class of the plugin. Format: module/Class | ||
# If `module` is omitted, will default to last module specified in the module list. | ||
# Even if `module` is not omitted here, it must be included in the modules list. | ||
# The main class must extend maubot.Plugin | ||
main_class: AlternatingCaps | ||
|
||
# Extra files that the upcoming build tool should include in the mbp file. | ||
|
||
#extra_files: | ||
#- base-config.yaml | ||
|
||
|
||
# List of dependencies | ||
#dependencies: | ||
#- foo | ||
|
||
#soft_dependencies: | ||
#- bar>=0.1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.