Skip to content

Commit ab49b93

Browse files
committed
Initial commit
0 parents  commit ab49b93

File tree

6 files changed

+872
-0
lines changed

6 files changed

+872
-0
lines changed

.github/workflows/pythonpublish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v1
12+
- name: Set up Python
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: '3.x'
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install setuptools wheel twine mypy requests types-requests
20+
- name: Run mypy
21+
run: mypy miniirc_matrix.py
22+
- name: Build and publish
23+
env:
24+
TWINE_USERNAME: __token__
25+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
26+
run: |
27+
python setup.py sdist bdist_wheel
28+
twine upload dist/*

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# Installer logs
28+
pip-log.txt
29+
pip-delete-this-directory.txt
30+
31+
# Mypy
32+
.mypy_cache/

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright © 2021 by luk3yx
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# miniirc_matrix
2+
3+
[![Available on PyPI.](https://img.shields.io/pypi/v/miniirc-matrix.svg)](https://pypi.org/project/miniirc-matrix/)
4+
5+
A wrapper for miniirc ([GitHub], [GitLab]) to allow bots or clients made in
6+
miniirc to join Matrix rooms with minimal code changes. Requires Python 3.8 or
7+
later.
8+
9+
## How to use
10+
11+
To use miniirc_matrix, you already need to know how to use miniirc ([GitHub],
12+
[GitLab]). Instead of creating a `miniirc.IRC` object, however, you need to
13+
use `miniirc_matrix.Matrix`.
14+
15+
- `ip` is the address of the Matrix homeserver.
16+
- `port` is optional and will default to 443 if not specified and if `ip`
17+
doesn't have a port.
18+
- There is a `token` keyword argument that must contain the Matrix token.
19+
20+
Example: `irc = miniirc_matrix.Matrix('matrix.org:443', token='my_token')`
21+
22+
Channel names are currently room IDs and start with `!`. You may use a Matrix
23+
room alias (for example `#matrix:matrix.org`) in place of a room ID, however.
24+
Hopefully one day alias support will be added so that channel names can
25+
correspond to alias names.
26+
27+
Formatting is translated to and from Matrix's custom HTML format. Note that
28+
colours are not supported in incoming messages, although they mostly work in
29+
outgoing messages.
30+
31+
[GitHub]: https://github.com/luk3yx/miniirc
32+
[GitLab]: https://gitlab.com/luk3yx/miniirc
33+
34+
## Obtaining a token
35+
36+
You must obtain a token to use miniirc_matrix. You can do this with
37+
`miniirc_matrix.login(homeserver_address, username, password)`.
38+
39+
There is also `miniirc_matrix.logout(homeserver_address, token)` and
40+
`miniirc_matrix.logout_all(homeserver_address, username, password)` if you wish
41+
to invalidate your token.
42+
43+
## Supported commands
44+
45+
The `PRIVMSG` (including `CTCP ACTION`/`irc.me`), `NOTICE`, `TAGMSG`, `JOIN`,
46+
and `PART` commands should work as expected.
47+
48+
Note that events sent before the client connects to Matrix are ignored. Your
49+
system must have an accurate clock for this to work properly.
50+
51+
## Installation
52+
53+
You can install `miniirc_matrix` with `pip install miniirc_matrix`.

0 commit comments

Comments
 (0)