9 Commits

Author SHA1 Message Date
0x5c 27863ae6bf Merge pull request #274 from miaowware/e-release
Bump version+changelog 2.4.1
2020-10-06 19:36:37 -04:00
classabbyamp de999bc39d fix error in workflow (#273) 2020-10-06 19:31:19 -04:00
0x5c 80d80ab718 Bump version+changelog 2.4.1 2020-10-06 19:26:57 -04:00
classabbyamp 8cb1a8df15 update docker documentation to remove docker hub mentions (#265)
Fixes #263
2020-10-06 19:17:02 -04:00
classabbyamp fa2dded81b Merge pull request #272 from miaowware/worflows-updates
add/update workflows
2020-10-06 19:16:13 -04:00
Abigail G bda0540fa8 add/update workflows
Fixes #270
Fixes #271
2020-10-06 19:13:00 -04:00
0x5c c9510ad9b9 Merge pull request #269 from miaowware/newcrap
Made bot work with new Intents system + only cache needed things
2020-10-06 19:01:46 -04:00
0x5c 00f9929deb Made bot work with new Intents system + only cache needed things
- all in one
- Bumped discord.py to 1.5.0

Fixes #267
Fixes #268
2020-10-06 18:56:45 -04:00
classabbyamp 3597367046 Create developer guide, remove issue/pr templates (#260)
* Create developer guide
* remove issue templates (they are in miaowware/.github now)
2020-10-04 22:29:00 -04:00
13 changed files with 186 additions and 195 deletions
-29
View File
@@ -1,29 +0,0 @@
---
name: Bug report
about: Report a bug to help us improve qrm
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Run command '...' with input '...'
2. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**System (include if related to running the bot):**
- OS: [e.g. Linux, Docker]
- Version: [e.g. 22]
**Additional context**
Add any other context about the problem here.
-20
View File
@@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for qrm
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
-29
View File
@@ -1,29 +0,0 @@
### Description
*Describe the changes you made here.*
Fixes #{issue}
### Type of change
Please delete options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- This change requires a documentation update
### How has this been tested?
*Describe the procedure used for verifying your changes here.*
### Checklist
- [ ] Issue exists for PR
- [ ] Code reviewed by the author
- [ ] Code documented (comments or other documentation)
- [ ] Changes tested
- [ ] `flake8` passes
- [ ] `CHANGELOG.md` updated
- [ ] Informative commit messages
- [ ] Descriptive PR title
+46 -28
View File
@@ -1,11 +1,13 @@
name: Docker Build and Push # vim: ts=2 sw=2:
name: Docker Build and Deploy
on: on:
push: push:
# Publish `master` as Docker `dev` image. # Publish `master` as Docker `dev` image.
branches: branches:
- master - master
# Publish `v*` tags as releases and as `latest`. # Publish `v*` tags as x.x.x images and as `latest`.
tags: tags:
- v* - v*
@@ -13,46 +15,62 @@ env:
IMAGE_NAME: qrm2 IMAGE_NAME: qrm2
jobs: jobs:
build-and-push: docker:
runs-on: ubuntu-latest name: Build and push docker images
runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2 - name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Write ref to file
run: git rev-list -n 1 $GITHUB_REF > ./git_commit
- name: Build image - name: Build image
run: | run: docker build . --file Dockerfile -t $IMAGE_NAME
echo ${{ github.sha }} > git_commit
docker build . --file Dockerfile -t $IMAGE_NAME
- name: Log into Github Package Registry - name: Log into Github Package Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Log into Docker Hub - name: Tag image
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin id: tag_image
- name: Push image to registries
run: | run: |
GITHUB_IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
DOCKER_IMAGE_ID=${{ secrets.DOCKER_USERNAME }}/$IMAGE_NAME echo IMAGE_ID=$IMAGE_ID
echo ::set-output name=image_id::$IMAGE_ID
# Strip git ref prefix from version # Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name # Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# if version is master, set version to dev
[[ "$VERSION" == "master" ]] && VERSION=dev [[ "$VERSION" == "master" ]] && VERSION=dev
echo GITHUB_IMAGE_ID=$GITHUB_IMAGE_ID
echo DOCKER_IMAGE_ID=$DOCKER_IMAGE_ID
echo VERSION=$VERSION echo VERSION=$VERSION
echo ::set-output name=version::$VERSION
# tag for Github Registry # tag dev or x.x.x
docker tag $IMAGE_NAME $GITHUB_IMAGE_ID:$VERSION docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
[[ "$VERSION" != "dev" ]] && docker tag $IMAGE_NAME $GITHUB_IMAGE_ID:latest # tag latest if not a dev release
docker push $GITHUB_IMAGE_ID [[ "$VERSION" != "dev" ]] && docker tag $IMAGE_NAME $IMAGE_ID:latest || true
# tag for Docker Hub - name: Push images to registry
docker tag $IMAGE_NAME $DOCKER_IMAGE_ID:$VERSION run: docker push ${{ steps.tag_image.outputs.image_id }}
[[ "$VERSION" != "dev" ]] && docker tag $IMAGE_NAME $DOCKER_IMAGE_ID:latest
docker push $DOCKER_IMAGE_ID # deploy:
# name: Deploy new images
# runs-on: ubuntu-20.04
# needs: docker
# steps:
# - name: Deploy official images
# id: deploy_images
# uses: satak/webrequest-action@v1.2.3
# with:
# url: ${{ secrets.DEPLOY_URL }}
# method: POST
# headers: '{"Authentication": "Token ${{ secrets.DEPLOY_TOKEN }}"}'
# payload: |
# '{
# "repository": "${{ github.repository }}",
# "version": "${{ jobs.docker.steps.tag_image.outputs.version }}"
# }'
+58
View File
@@ -0,0 +1,58 @@
# vim: ts=2 sw=2:
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Create Release
jobs:
release:
name: Create Release
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Get Version Info
id: get_tag
shell: bash
run: |
SUBJECT=$(/usr/bin/git tag -l ${GITHUB_REF#refs/tags/} --format='%(subject)')
BODY=$(/usr/bin/git tag -l ${GITHUB_REF#refs/tags/} --format='%(body)' | sed '/-----BEGIN PGP SIGNATURE-----/,$d')
echo SUBJECT=$SUBJECT
echo BODY=$BODY
echo ::set-output name=subject::${SUBJECT}
echo ::set-output name=body::${BODY}
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
- name: Get Changelog Content
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ steps.get_tag.outputs.current_version }}
path: ./CHANGELOG.md
- name: Publish Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog_reader.outputs.version }}
release_name: ${{ steps.get_tag.outputs.subject }}
body: |
${{ steps.get_tag.outputs.body }}
## Changelog
${{ steps.changelog_reader.outputs.changes }}
draft: false
prerelease: false
+7 -1
View File
@@ -7,6 +7,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] ## [Unreleased]
## [2.4.1] - 2020-10-06
### Changed
- Bumped discord.py to 1.5.0
## [2.4.0] - 2020-09-27 ## [2.4.0] - 2020-09-27
### Added ### Added
- Canadian prefix info to the `?prefixes` command. - Canadian prefix info to the `?prefixes` command.
@@ -124,7 +129,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 1.0.0 - 2019-07-31 [YANKED] ## 1.0.0 - 2019-07-31 [YANKED]
[Unreleased]: https://github.com/miaowware/qrm2/compare/v2.4.0...HEAD [Unreleased]: https://github.com/miaowware/qrm2/compare/v2.4.1...HEAD
[2.4.1]: https://github.com/miaowware/qrm2/releases/tag/v2.4.1
[2.4.0]: https://github.com/miaowware/qrm2/releases/tag/v2.4.0 [2.4.0]: https://github.com/miaowware/qrm2/releases/tag/v2.4.0
[2.3.2]: https://github.com/miaowware/qrm2/releases/tag/v2.3.2 [2.3.2]: https://github.com/miaowware/qrm2/releases/tag/v2.3.2
[2.3.1]: https://github.com/miaowware/qrm2/releases/tag/v2.3.1 [2.3.1]: https://github.com/miaowware/qrm2/releases/tag/v2.3.1
-77
View File
@@ -1,77 +0,0 @@
# Contributing to qrm
## Before You Start
- Make sure there's an issue for the feature, bugfix, or other improvement you want to make.
- Make sure it's something that the project maintainers want.
We can discuss it and assign the issue to you.
- Make sure work isn't already being done on the issue.
### Environment Setup
Once all of the above is done, you can get started by setting up your development envronment.
1. [Fork this repo][1] into your own GitHub namespace.
1. Make sure the `master` branch is up to date, then make yourself a new branch with a descriptive name.
1. Once the forked repo is cloned and on the proper branch, you can set up the development environment.
1. Install python 3.7 or higher.
1. Run `make dev-install`.
This should install everything you need to develop and run qrm.
1. [Create a bot and token][2], and add it to `data/keys.py`.
Also add your [QRZ credentials][3] if needed.
1. In `data/options.py`, change values as needed.
Some commands require adding your Discord user ID to `owner_uids`.
1. To activate the virtual env that was created by `make`, run `source botenv/bin/activate` (or the equivelent for your shell or operating system).
## While You Develop
To run qrm, use the command `./run.sh`.
We recommend you use the `--pass-errors` flags to avoid perpetual restart loops if you break the bot.
It exists because repeatedly mashing [Ctrl+C] at high speed to break a fast loop is not fun.
Commit messages should be descriptive and mention issues that they fix ("fixes #123") or contain progress on ("progress on #123").
Make commits as needed, but try to keep it reasonable.
If there are too many, your contribution may be squashed when merged.
You may want to squash your commits locally yourself:
```sh
git reset --soft [commit before your changes]
git commit
```
Make sure to document your code as you go, in both comments and external documentation (in `/dev-notes/`) as needed.
`dev-notes` is especially important if you introduce a new json file format or to document some development process (like the command to crush the various images in the repository).
**Test your changes.**
If your code doesn't work, it's not ready for merging.
Make sure you not only test intended behaviour, but also edge cases and error cases.
Make sure to run `flake8` to ensure your code uses the proper style, and `mypy [files...]` to ensure proper typing.
If you're making a user-facing change, put a quick summary in `CHANGELOG.md` under the `[Unreleased]` heading.
Follow the [Keep a Changelog][4] format.
### A Note on Style
qrm tries to keep to PEP 8 style whenever possible.
Use the utility `flake8` to check that you follow this style.
When you start a PR or push commits, GitHub will automatically run this for you;
if that fails, you will be expected to fix those errors before merge.
Otherwise, try to follow the existing style:
double-quotes except when required to be single,
indentation of mult-line structures matching other examples in the code,
add type hints,
etc.
## When You're Ready to Merge
1. When you have finished working on your contribution, create a pull request from your fork's branch into the master branch of this repository.
1. Read through and complete the pull request template.
If the checklist is not complete, your contribution will not be merged.
1. Your pull request will get reviewed by at least one maintainer.
1. If approved, another maintainer may merge the pull request if everything looks good.
[1]: https://github.com/miaowware/qrm2/fork
[2]: https://discordpy.readthedocs.io/en/latest/discord.html
[3]: https://www.qrz.com/page/xml_data.html
[4]: https://keepachangelog.com/en/1.0.0/
+54
View File
@@ -0,0 +1,54 @@
# Development Guide for qrm
**Make sure to also read [`CONTRIBUTING.md`][0], everything in there applies here.**
### Environment Setup
1. [Fork this repo][1] into your own GitHub namespace.
1. Make sure the `master` branch is up to date, then make yourself a new branch with a descriptive name.
1. Once the forked repo is cloned and on the proper branch, you can set up the development environment.
1. Install python 3.7 or higher.
1. Run `make dev-install`.
This should install everything you need to develop and run qrm.
1. [Create a bot and token][2], and add it to `data/keys.py`.
Also add your [QRZ credentials][3] if needed.
1. In `data/options.py`, change values as needed.
Some commands require adding your Discord user ID to `owner_uids`.
1. To activate the virtual env that was created by `make`, run `source botenv/bin/activate` (or the equivelent for your shell or operating system).
These instructions are fairly \*NIX-centric, so if you would like to develop on Windows, it is suggested that the Windows Subsystem for Linux be used.
## While You Develop
To run qrm, use the command `./run.sh`.
We recommend you use the `--pass-errors` flag to avoid perpetual restart loops if you break the bot.
It exists because repeatedly mashing [Ctrl+C] at high speed to break a fast loop is not fun.
Make sure to add [type hints][4] to your code.
This is what `mypy` validates in the code.
Using `dev-notes` for documentation is especially important if you introduce a new json file format (like for maps and bandplans) or to document some development process (like the command to crush the various images in the repository).
### Test your changes
In addition to testing functionality, make sure to run `flake8` to ensure your code uses the proper style, and `mypy [files...]` to ensure proper typing.
You can also enable them for this project in your IDE if supported.
This will give you automatic and continuous linting and type checking.
### A Note on Style
qrm tries to keep to PEP 8 style whenever possible.
Use the utility `flake8` to check that you follow this style.
When you start a PR or push commits, GitHub will automatically run this for you,
but we prefer that developers check this before committing and opening PRs.
Otherwise, try to follow the existing style:
- double-quotes except when required to be single,
- indentation of mult-line structures matching other examples in the code,
- etc.
[0]: https://github.com/miaowware/.github/blob/master/CONTRIBUTING.md
[1]: https://github.com/miaowware/qrm2/fork
[2]: https://discordpy.readthedocs.io/en/latest/discord.html
[3]: https://www.qrz.com/page/xml_data.html
[4]: https://docs.python.org/3/library/typing.html
+6 -8
View File
@@ -23,16 +23,14 @@ This is the easiest method for running the bot without any modifications.
version: '3' version: '3'
services: services:
qrm2: qrm2:
image: "classabbyamp/qrm2:latest" image: "docker.pkg.github.com/miaowware/qrm2/qrm2:latest"
# OR
# image: "docker.pkg.github.com/miaowware/qrm2/qrm2:latest"
restart: on-failure restart: on-failure
volumes: volumes:
- "./data:/app/data:rw" - "./data:/app/data:rw"
environment: environment:
- PYTHONUNBUFFERED=1 - PYTHONUNBUFFERED=1
``` ```
> Note that there are two possible sources for the image: docker's and github's registry. Github's registry requires [a few extra steps](https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages) during the initial setup. *Note that Github's registry requires [a few extra steps](https://docs.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages) during the initial setup.*
3. Create a subdirectory named `data`. 3. Create a subdirectory named `data`.
@@ -45,7 +43,7 @@ This is the easiest method for running the bot without any modifications.
$ docker-compose up -d $ docker-compose up -d
``` ```
> Run without "-d" to test the bot. (run in foreground) *Run without "-d" to test the bot (run in foreground).*
@@ -81,7 +79,7 @@ This is the easiest method to run the bot with modifications.
$ docker-compose up -d $ docker-compose up -d
``` ```
> Run without "-d" to test the bot. (run in foreground) *Run without "-d" to test the bot (run in foreground).*
@@ -113,5 +111,5 @@ This methods is not very nice to use.
``` ```
Where `[image]` is either of: Where `[image]` is either of:
- `discord-qrm2:local-latest` if you are building your own. - `qrm2:local-latest` if you are building your own.
- `classabbyamp/discord-qrm2:latest` if you want to use the prebuilt image. - `docker.pkg.github.com/miaowware/qrm2/qrm2:latest` if you want to use the prebuilt image.
+1 -1
View File
@@ -1,3 +1,3 @@
-r requirements.txt -r requirements.txt
flake8 flake8
discord.py-stubs discord.py-stubs==1.5.0
+1 -1
View File
@@ -12,5 +12,5 @@ authors = ("@ClassAbbyAmplifier#2229", "@0x5c#0639")
description = """A bot with various useful ham radio-related functions, written in Python.""" description = """A bot with various useful ham radio-related functions, written in Python."""
license = "Released under the GNU General Public License v2" license = "Released under the GNU General Public License v2"
contributing = "Check out the source on GitHub, contributions welcome: https://github.com/miaowware/qrm2" contributing = "Check out the source on GitHub, contributions welcome: https://github.com/miaowware/qrm2"
release = "2.4.0" release = "2.4.1"
bot_server = "https://discord.gg/Ntbg3J4" bot_server = "https://discord.gg/Ntbg3J4"
+12
View File
@@ -44,9 +44,21 @@ debug_mode = opt.debug # Separate assignement in-case we define an override (te
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
connector = loop.run_until_complete(conn.new_connector()) connector = loop.run_until_complete(conn.new_connector())
# Defining the intents
intents = discord.Intents.default()
# We don't need those
intents.bans = False
intents.emojis = False
intents.integrations = False
intents.webhooks = False
intents.invites = False
intents.voice_states = False
intents.typing = False
bot = commands.Bot(command_prefix=opt.prefix, bot = commands.Bot(command_prefix=opt.prefix,
case_insensitive=True, case_insensitive=True,
description=info.description, help_command=commands.MinimalHelpCommand(), description=info.description, help_command=commands.MinimalHelpCommand(),
intents=intents,
loop=loop, loop=loop,
connector=connector) connector=connector)
+1 -1
View File
@@ -1,4 +1,4 @@
discord.py==1.3.4 discord.py==1.5.0
ctyparser==2.0.0.post1 ctyparser==2.0.0.post1
beautifulsoup4==4.9.1 beautifulsoup4==4.9.1
lxml==4.5.2 lxml==4.5.2