theticketbot 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- theticketbot-0.4.0/.github/CODEOWNERS +1 -0
- theticketbot-0.4.0/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
- theticketbot-0.4.0/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
- theticketbot-0.4.0/.github/pull_request_template.md +11 -0
- theticketbot-0.4.0/.github/workflows/publish-pypi.yml +45 -0
- theticketbot-0.4.0/.github/workflows/pyright-lint.yml +29 -0
- theticketbot-0.4.0/.gitignore +164 -0
- theticketbot-0.4.0/.pre-commit-config.yaml +16 -0
- theticketbot-0.4.0/CHANGELOG.md +129 -0
- theticketbot-0.4.0/CONTRIBUTING.md +116 -0
- theticketbot-0.4.0/LICENSE +21 -0
- theticketbot-0.4.0/MANIFEST.in +3 -0
- theticketbot-0.4.0/PKG-INFO +331 -0
- theticketbot-0.4.0/README.md +301 -0
- theticketbot-0.4.0/docs/dev/concept.md +33 -0
- theticketbot-0.4.0/docs/images/demo.png +0 -0
- theticketbot-0.4.0/pyproject.toml +44 -0
- theticketbot-0.4.0/setup.cfg +4 -0
- theticketbot-0.4.0/setup.py +141 -0
- theticketbot-0.4.0/src/theticketbot/__init__.py +7 -0
- theticketbot-0.4.0/src/theticketbot/__main__.py +137 -0
- theticketbot-0.4.0/src/theticketbot/appdirs.py +25 -0
- theticketbot-0.4.0/src/theticketbot/bot.py +133 -0
- theticketbot-0.4.0/src/theticketbot/cogs/cleanup.py +73 -0
- theticketbot-0.4.0/src/theticketbot/cogs/errors.py +289 -0
- theticketbot-0.4.0/src/theticketbot/cogs/inbox.py +983 -0
- theticketbot-0.4.0/src/theticketbot/cogs/owner.py +57 -0
- theticketbot-0.4.0/src/theticketbot/cogs/select.py +108 -0
- theticketbot-0.4.0/src/theticketbot/config.py +174 -0
- theticketbot-0.4.0/src/theticketbot/config_default.toml +45 -0
- theticketbot-0.4.0/src/theticketbot/database.py +313 -0
- theticketbot-0.4.0/src/theticketbot/errors.py +26 -0
- theticketbot-0.4.0/src/theticketbot/locales/README.md +3 -0
- theticketbot-0.4.0/src/theticketbot/locales/de/LC_MESSAGES/theticketbot.po +460 -0
- theticketbot-0.4.0/src/theticketbot/locales/en_US/LC_MESSAGES/theticketbot.po +416 -0
- theticketbot-0.4.0/src/theticketbot/locales/fr/LC_MESSAGES/theticketbot.po +452 -0
- theticketbot-0.4.0/src/theticketbot/migrations/001-base.sql +63 -0
- theticketbot-0.4.0/src/theticketbot/migrations/002-add-default-ticket-name.sql +3 -0
- theticketbot-0.4.0/src/theticketbot/migrations/003-add-inbox-counter.sql +3 -0
- theticketbot-0.4.0/src/theticketbot/migrations/004-replace-name-placeholder.sql +5 -0
- theticketbot-0.4.0/src/theticketbot/migrations.py +94 -0
- theticketbot-0.4.0/src/theticketbot/theticketbot.pot +414 -0
- theticketbot-0.4.0/src/theticketbot/translator.py +144 -0
- theticketbot-0.4.0/src/theticketbot.egg-info/PKG-INFO +331 -0
- theticketbot-0.4.0/src/theticketbot.egg-info/SOURCES.txt +49 -0
- theticketbot-0.4.0/src/theticketbot.egg-info/dependency_links.txt +1 -0
- theticketbot-0.4.0/src/theticketbot.egg-info/entry_points.txt +2 -0
- theticketbot-0.4.0/src/theticketbot.egg-info/requires.txt +8 -0
- theticketbot-0.4.0/src/theticketbot.egg-info/top_level.txt +1 -0
- theticketbot-0.4.0/utils/build_mo.py +9 -0
- theticketbot-0.4.0/utils/merge_po.py +86 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @thegamecracks
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a bug report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
### Describe the bug
|
|
11
|
+
|
|
12
|
+
A clear and concise description of what the bug is.
|
|
13
|
+
|
|
14
|
+
Project version that this has been tested on: [e.g. 1.0.0]
|
|
15
|
+
|
|
16
|
+
### To Reproduce
|
|
17
|
+
|
|
18
|
+
Steps to reproduce the behavior:
|
|
19
|
+
1. Run command '...'
|
|
20
|
+
2. Click on '...'
|
|
21
|
+
3. Type in '...'
|
|
22
|
+
4. See error
|
|
23
|
+
|
|
24
|
+
### Expected behavior
|
|
25
|
+
|
|
26
|
+
A clear and concise description of what you expected to happen.
|
|
27
|
+
|
|
28
|
+
### Screenshots
|
|
29
|
+
|
|
30
|
+
If applicable, add screenshots to help explain your problem.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
### Is your feature request related to a problem? Please describe
|
|
11
|
+
|
|
12
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
13
|
+
|
|
14
|
+
### Describe the solution you'd like
|
|
15
|
+
|
|
16
|
+
A clear and concise description of what you want to happen.
|
|
17
|
+
|
|
18
|
+
### Describe alternatives you've considered
|
|
19
|
+
|
|
20
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
21
|
+
|
|
22
|
+
### Additional context
|
|
23
|
+
|
|
24
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
<!-- What does this pull request do? -->
|
|
4
|
+
|
|
5
|
+
## Checklist
|
|
6
|
+
|
|
7
|
+
<!-- Put an X inside [ ] to check it, like so: [X] -->
|
|
8
|
+
|
|
9
|
+
- [ ] This PR does *not* change any code (localization, documentation, ...)
|
|
10
|
+
- [ ] If code changes were made then I have tested them.
|
|
11
|
+
- [ ] I have updated any docstrings/documentation to reflect my changes.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- v*
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
env:
|
|
12
|
+
LOCALE_MANDATORY: '1'
|
|
13
|
+
steps:
|
|
14
|
+
- run: sudo apt-get update
|
|
15
|
+
- run: sudo apt-get install gettext
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
fetch-tags: true
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
cache: pip
|
|
23
|
+
cache-dependency-path: pyproject.toml
|
|
24
|
+
python-version: "3.11"
|
|
25
|
+
- run: pip install build
|
|
26
|
+
- run: python -m build
|
|
27
|
+
- uses: actions/upload-artifact@v4
|
|
28
|
+
with:
|
|
29
|
+
name: dist-${{ runner.os }}
|
|
30
|
+
path: dist/
|
|
31
|
+
|
|
32
|
+
publish:
|
|
33
|
+
environment: release
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
permissions:
|
|
36
|
+
id-token: write
|
|
37
|
+
needs:
|
|
38
|
+
- build
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/download-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
pattern: dist-*
|
|
43
|
+
path: dist/
|
|
44
|
+
merge-multiple: true
|
|
45
|
+
- uses: pypa/gh-action-pypi-publish@v1.9.0
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Lint with Pyright
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths:
|
|
6
|
+
- '**.py'
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
paths:
|
|
11
|
+
- '**.py'
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
lint:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
fetch-depth: 0
|
|
21
|
+
fetch-tags: true
|
|
22
|
+
- uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
cache: pip
|
|
25
|
+
cache-dependency-path: pyproject.toml
|
|
26
|
+
python-version-file: pyproject.toml
|
|
27
|
+
- run: pip install pyright
|
|
28
|
+
- run: pip install .
|
|
29
|
+
- run: pyright
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/data/
|
|
2
|
+
/config*.toml
|
|
3
|
+
.vscode/
|
|
4
|
+
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py,cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
# *.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# poetry
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
106
|
+
#poetry.lock
|
|
107
|
+
|
|
108
|
+
# pdm
|
|
109
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
110
|
+
#pdm.lock
|
|
111
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
112
|
+
# in version control.
|
|
113
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
114
|
+
.pdm.toml
|
|
115
|
+
|
|
116
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
117
|
+
__pypackages__/
|
|
118
|
+
|
|
119
|
+
# Celery stuff
|
|
120
|
+
celerybeat-schedule
|
|
121
|
+
celerybeat.pid
|
|
122
|
+
|
|
123
|
+
# SageMath parsed files
|
|
124
|
+
*.sage.py
|
|
125
|
+
|
|
126
|
+
# Environments
|
|
127
|
+
.env
|
|
128
|
+
.venv
|
|
129
|
+
env/
|
|
130
|
+
venv/
|
|
131
|
+
ENV/
|
|
132
|
+
env.bak/
|
|
133
|
+
venv.bak/
|
|
134
|
+
|
|
135
|
+
# Spyder project settings
|
|
136
|
+
.spyderproject
|
|
137
|
+
.spyproject
|
|
138
|
+
|
|
139
|
+
# Rope project settings
|
|
140
|
+
.ropeproject
|
|
141
|
+
|
|
142
|
+
# mkdocs documentation
|
|
143
|
+
/site
|
|
144
|
+
|
|
145
|
+
# mypy
|
|
146
|
+
.mypy_cache/
|
|
147
|
+
.dmypy.json
|
|
148
|
+
dmypy.json
|
|
149
|
+
|
|
150
|
+
# Pyre type checker
|
|
151
|
+
.pyre/
|
|
152
|
+
|
|
153
|
+
# pytype static type analyzer
|
|
154
|
+
.pytype/
|
|
155
|
+
|
|
156
|
+
# Cython debug symbols
|
|
157
|
+
cython_debug/
|
|
158
|
+
|
|
159
|
+
# PyCharm
|
|
160
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
161
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
162
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
163
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
164
|
+
#.idea/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
default_language_version:
|
|
2
|
+
python: python3.11
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v4.6.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: check-added-large-files
|
|
8
|
+
- id: check-ast
|
|
9
|
+
- id: check-toml
|
|
10
|
+
- id: check-yaml
|
|
11
|
+
- id: end-of-file-fixer
|
|
12
|
+
- id: trailing-whitespace
|
|
13
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
14
|
+
rev: 24.4.2
|
|
15
|
+
hooks:
|
|
16
|
+
- id: black
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.4.0] - 2024-06-26
|
|
10
|
+
|
|
11
|
+
This is theticketbot's first release to go on [PyPI](https://pypi.org/project/theticketbot/)! 🎉
|
|
12
|
+
|
|
13
|
+
### Changes
|
|
14
|
+
|
|
15
|
+
- BREAKING CHANGE:
|
|
16
|
+
The default database path now defaults to a user-specific directory
|
|
17
|
+
on your current platform.
|
|
18
|
+
- This path can be revealed by running `theticketbot --dump-config`.
|
|
19
|
+
- Users who want to revert to the old behaviour must explicitly write
|
|
20
|
+
`path = "data/theticketbot.db"` in their config file's `[db]` table.
|
|
21
|
+
- Add classifiers, license, keywords, and URLs to the project's metadata
|
|
22
|
+
- Unpin discord.py to `~=2.4`
|
|
23
|
+
- Use PyPI version of asqlite pinned at `==2.0.0`
|
|
24
|
+
|
|
25
|
+
### Fixes
|
|
26
|
+
|
|
27
|
+
- Disable the polls intent by default, and don't enable any future standard intents
|
|
28
|
+
when upgrading discord.py
|
|
29
|
+
|
|
30
|
+
## [0.3.2] - 2024-06-19
|
|
31
|
+
|
|
32
|
+
### New Features
|
|
33
|
+
|
|
34
|
+
- Add french localization, courtesy of @Bubobubobubobubo
|
|
35
|
+
- Add `--sync` command-line argument to make registering application commands easier
|
|
36
|
+
|
|
37
|
+
## [0.3.1] - 2024-06-17
|
|
38
|
+
|
|
39
|
+
### New Features
|
|
40
|
+
|
|
41
|
+
- Automatically lock tickets when archived by staff / auto-archived,
|
|
42
|
+
and bot is given Manage Threads permission ([#5])
|
|
43
|
+
|
|
44
|
+
## [0.3.0] - 2024-06-10
|
|
45
|
+
|
|
46
|
+
### New Features
|
|
47
|
+
|
|
48
|
+
- Add german localization, courtesy of @GamingGalaxy200
|
|
49
|
+
- Add `/inbox message` for editing inbox messages in-place ([#2])
|
|
50
|
+
- Add `/inbox staff` all-in-one command for adding, listing, and removing inbox staff
|
|
51
|
+
- Use per-channel Manage Threads permission to automatically add staff for new inboxes ([#8])
|
|
52
|
+
- Prompt to select messages after using a command instead of requiring a selection beforehand ([#3])
|
|
53
|
+
- This should make the user experience easier overall, but may make it less convenient to perform multiple commands on the same message.
|
|
54
|
+
- Automatically cleanup deleted roles from inbox staff ([#4])
|
|
55
|
+
- Automatically archive tickets when their owner leaves the server
|
|
56
|
+
- Optionally lock tickets during archival when the bot is given the Manage Threads permission
|
|
57
|
+
- Add `theticketbot` console script as an alternative to `python -m theticketbot`
|
|
58
|
+
- Supports running with [pipx](https://pipx.pypa.io/latest/), if desired
|
|
59
|
+
- Add experimental support for encrypted SQLite databases
|
|
60
|
+
- See the [README](https://github.com/thegamecracks/theticketbot/blob/v0.3.0/README.md#encryption) for usage
|
|
61
|
+
|
|
62
|
+
### Changes
|
|
63
|
+
|
|
64
|
+
- Make `/inbox` command guild-only
|
|
65
|
+
- Don't include commas in the `$staff` placeholder for ticket starters
|
|
66
|
+
- Rename `$name` to `$author` in ticket name placeholders
|
|
67
|
+
- This is automatically applied to existing inboxes during database migrations.
|
|
68
|
+
- Don't request guild members during startup
|
|
69
|
+
- This can significantly reduce unnecessary bandwidth when added to large guilds.
|
|
70
|
+
- For user convenience, reset timeouts for message selection commands when an error occurs
|
|
71
|
+
- Previously, the selection would always timeout 180s after the initial slash command even if the user was selecting messages.
|
|
72
|
+
- Remove Manage Server permission check on inbox message selections
|
|
73
|
+
- This is no longer needed since the new message selection system is isolated to each guild, preventing users from attempting to manage inboxes from other guilds. Admins can now grant the `/inbox` command to staff that don't have the Manage Server permission.
|
|
74
|
+
|
|
75
|
+
### Fixes
|
|
76
|
+
|
|
77
|
+
- Fix deleted threads not being removed from database while bot is online
|
|
78
|
+
|
|
79
|
+
### Removals
|
|
80
|
+
|
|
81
|
+
- `/inbox staff add`
|
|
82
|
+
- `/inbox staff list`
|
|
83
|
+
- `/inbox staff remove`
|
|
84
|
+
|
|
85
|
+
## [0.2.0] - 2024-06-04
|
|
86
|
+
|
|
87
|
+
### New Features
|
|
88
|
+
|
|
89
|
+
- Add `/inbox new-tickets name` for customizing names of new tickets
|
|
90
|
+
- See the [README](https://github.com/thegamecracks/theticketbot/blob/v0.2.0/README.md#customization) for available placeholders
|
|
91
|
+
- Allow customizing per-user inbox ratelimits with native channel slowmode settings
|
|
92
|
+
- As of now, this ratelimit cannot be lower than 60 seconds.
|
|
93
|
+
- Automatically archive tickets after being left by their owners
|
|
94
|
+
- Show a helpful message when creating a ticket on an unrecognized inbox
|
|
95
|
+
- Automated clean up of obsolete guilds in database, running every saturday
|
|
96
|
+
|
|
97
|
+
### Changes
|
|
98
|
+
|
|
99
|
+
- Update intents in default configuration:
|
|
100
|
+
- `members = true`
|
|
101
|
+
- This is needed to track when ticket owners leave their thread.
|
|
102
|
+
- `message_content = false`
|
|
103
|
+
- For now, all message content needed for bot functionality can be received without this intent.
|
|
104
|
+
- Use [setuptools-scm](https://setuptools-scm.readthedocs.io/en/latest/) in build system
|
|
105
|
+
- Version automatically changes according to Git repository tags
|
|
106
|
+
- All tracked files are now included in source distributions
|
|
107
|
+
|
|
108
|
+
### Removals
|
|
109
|
+
|
|
110
|
+
- `/inbox starter get`
|
|
111
|
+
- `/inbox starter set` - renamed to `/inbox new-tickets starter`
|
|
112
|
+
|
|
113
|
+
## [0.1.0] - 2024-06-03
|
|
114
|
+
|
|
115
|
+
This is theticketbot's first release! 🎉
|
|
116
|
+
|
|
117
|
+
[Unreleased]: https://github.com/thegamecracks/theticketbot/compare/v0.4.0...main
|
|
118
|
+
[0.4.0]: https://github.com/thegamecracks/theticketbot/compare/v0.3.2...v0.4.0
|
|
119
|
+
[0.3.2]: https://github.com/thegamecracks/theticketbot/compare/v0.3.1...v0.3.2
|
|
120
|
+
[0.3.1]: https://github.com/thegamecracks/theticketbot/compare/v0.3.0...v0.3.1
|
|
121
|
+
[0.3.0]: https://github.com/thegamecracks/theticketbot/compare/v0.2.0...v0.3.0
|
|
122
|
+
[0.2.0]: https://github.com/thegamecracks/theticketbot/compare/v0.1.1...v0.2.0
|
|
123
|
+
[0.1.0]: https://github.com/thegamecracks/theticketbot/releases/tag/v0.1.0
|
|
124
|
+
|
|
125
|
+
[#8]: https://github.com/thegamecracks/theticketbot/issues/8
|
|
126
|
+
[#5]: https://github.com/thegamecracks/theticketbot/issues/5
|
|
127
|
+
[#4]: https://github.com/thegamecracks/theticketbot/issues/4
|
|
128
|
+
[#3]: https://github.com/thegamecracks/theticketbot/issues/3
|
|
129
|
+
[#2]: https://github.com/thegamecracks/theticketbot/issues/2
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Development Setup
|
|
2
|
+
|
|
3
|
+
When installing the project for development, you can enable [editable mode]
|
|
4
|
+
and install the [Jishaku] extension to help with iterative development and
|
|
5
|
+
debugging:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pip install --editable .[jishaku]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
[editable mode]: https://setuptools.pypa.io/en/latest/userguide/development_mode.html
|
|
12
|
+
[Jishaku]: https://github.com/Gorialis/jishaku
|
|
13
|
+
|
|
14
|
+
You can also install this project's [pre-commit] hooks to automatically
|
|
15
|
+
run lints for you:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
pip install pre-commit
|
|
19
|
+
pre-commit install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
[pre-commit]: https://pre-commit.com/
|
|
23
|
+
|
|
24
|
+
And finally, you should use [Pyright] to type-check your code before committing.
|
|
25
|
+
In VSCode, this is built into the Pylance extension and can be enabled in
|
|
26
|
+
your settings, but you can also install the third-party pyright wrapper
|
|
27
|
+
to manually run it:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pip install pyright
|
|
31
|
+
pyright
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[Pyright]: https://microsoft.github.io/pyright/
|
|
35
|
+
|
|
36
|
+
Database migration scripts are stored in [migrations/] and are automatically
|
|
37
|
+
executed upon bot startup. During development, if any changes to the database
|
|
38
|
+
schema are required, please create a backup of your database before adding a
|
|
39
|
+
new migration script.
|
|
40
|
+
|
|
41
|
+
[migrations/]: https://github.com/thegamecracks/theticketbot/tree/main/src/theticketbot/migrations/
|
|
42
|
+
|
|
43
|
+
When updating any file that contains `_()` translatable strings,
|
|
44
|
+
it is recommended to run `utils/merge_po.py` and `utils/build_mo.py`
|
|
45
|
+
just before starting the bot or creating a commit.
|
|
46
|
+
This requires gettext to be installed.
|
|
47
|
+
|
|
48
|
+
# Python Style Guide
|
|
49
|
+
|
|
50
|
+
- Code should follow [PEP 8] where possible, unless exempted by this guide
|
|
51
|
+
- When unsure, run [Black] to format your code
|
|
52
|
+
- Use `# fmt: off` and `# fmt: on` comments to override the formatter when necessary
|
|
53
|
+
|
|
54
|
+
- Unlike PEP 8, the max line length allowed in this codebase is 88 characters
|
|
55
|
+
|
|
56
|
+
- Variable names must **NOT** be abbreviated unless their usage is already
|
|
57
|
+
conventional, such as `i`/`j` for indices or `c` for characters.
|
|
58
|
+
In general, prefer explicit and readable names over short variable names.
|
|
59
|
+
|
|
60
|
+
```py
|
|
61
|
+
# Bad:
|
|
62
|
+
n = "thegamecracks"
|
|
63
|
+
un = "thegamecracks"
|
|
64
|
+
uName = "thegamecracks"
|
|
65
|
+
# Good:
|
|
66
|
+
user_name = "thegamecracks"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- Trailing commas **MUST** be used when arguments/elements are spread out
|
|
70
|
+
over several lines
|
|
71
|
+
- This includes single-length arguments/elements like `function(arg)`.
|
|
72
|
+
If doing so would exceed the line length, consider refactoring the argument
|
|
73
|
+
into a separate variable if not already done.
|
|
74
|
+
|
|
75
|
+
- Line continuations (`\`) are **NOT** allowed and should be managed with either
|
|
76
|
+
implicit line continuations, decomposition of expressions into multiple statements,
|
|
77
|
+
or refactoring into functions.
|
|
78
|
+
|
|
79
|
+
- All code must **NOT** have any trailing whitespace
|
|
80
|
+
|
|
81
|
+
- As an extension to PEP 8, imports should be grouped into the following order:
|
|
82
|
+
- Built-in modules
|
|
83
|
+
- Third-party modules
|
|
84
|
+
- Absolute imports of local modules
|
|
85
|
+
- Relative imports of local modules
|
|
86
|
+
|
|
87
|
+
```py
|
|
88
|
+
import sqlite3
|
|
89
|
+
import time
|
|
90
|
+
from typing import Awaitable, Callable, Iterable
|
|
91
|
+
|
|
92
|
+
import asqlite
|
|
93
|
+
import discord
|
|
94
|
+
from discord.ext import commands
|
|
95
|
+
|
|
96
|
+
from theticketbot.database import DatabaseClient
|
|
97
|
+
|
|
98
|
+
from .config import load_config
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- Relatve imports **MAY** be used for sibling modules, i.e. those that reside
|
|
102
|
+
in the same directory
|
|
103
|
+
|
|
104
|
+
- Absolute imports **MUST** be used for parent modules, i.e. those that exist
|
|
105
|
+
outside of the module. In other words, relative imports consisting of two
|
|
106
|
+
or more leadiing periods must be refactored into absolute imports.
|
|
107
|
+
|
|
108
|
+
```py
|
|
109
|
+
# Bad:
|
|
110
|
+
from ..database import DatabaseClient
|
|
111
|
+
# Good:
|
|
112
|
+
from theticketbot.database import DatabaseClient
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
[PEP 8]: https://peps.python.org/pep-0008/
|
|
116
|
+
[Black]: https://black.readthedocs.io/en/stable/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 thegamecracks
|
|
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.
|