Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/v2020.48.0' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
TurnrDev committed Nov 26, 2020
2 parents 6710b71 + 1bb379b commit a81f949
Show file tree
Hide file tree
Showing 30 changed files with 2,625 additions and 1,074 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
title: "[BUG] "
labels: bug
assignees: TurnrDev

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
title: '[IDEA] '
labels: enhancement
assignees: TurnrDev

Expand Down
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,21 @@ updates:
- turnrdev
assignees:
- turnrdev
commit-message:
prefix: "deps: "
labels:
- "dependencies"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
target-branch: develop
reviewers:
- turnrdev
assignees:
- turnrdev
commit-message:
prefix: "chore: "
labels:
- "dependencies"
8 changes: 5 additions & 3 deletions .github/workflows/crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
crowdin:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

strategy:
matrix:
Expand All @@ -28,18 +28,20 @@ jobs:
run: |
python -m redgettext -c tdx
- name: Update Crowdin
uses: crowdin/[email protected].9
uses: crowdin/[email protected].13
with:
upload_sources: true
source: 'tdx/locales/messages.pot'
translation: 'tdx/locales/%locale%.po'
upload_translations: false
download_translations: true
commit_message: 'chore: update translations via Crowdin'
pull_request_title: 'chore: update translations via Crowdin'
pull_request_labels: 'i18n'
crowdin_branch_name: 'master'
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## [2020.48.0] - 2020-11-26
### Changed
- Fixed `[p]editprofile trainercode`
- Fixed `[p]editprofile startdate`
- Fixed a bug in `[p]profile` where it would return yourself if it can't find who you're looking for
- Aliased `$stc` to `[p]editprofile trainercode` so hook into commands intended for PokeNav to set the Trainer Code so you only need to set once.

### Added
- Added `trainercode` to search for trainer codes


## [2020.40.2] - 2020-10-02
### Dependencies
- Bump [https://github.com/TrainerDex/PogoOCR](PogoOCR) to [https://github.com/TrainerDex/PogoOCR/compare/0.3.2...0.3.4](0.3.4)
Expand Down Expand Up @@ -151,8 +162,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- `[p]progress (mention)`
- Settings commands

[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v2020.40.0...HEAD
[2020.48.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v2020.38.0...v2020.40.0
[Unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v2020.48.0...HEAD
[2020.48.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v2020.40.2...v2020.48.0
[2020.40.2]: https://github.com/olivierlacan/keep-a-changelog/compare/v2020.40.0...v2020.40.2
[2020.40.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v2020.38.0...v2020.40.0
[2020.38.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v2020.37.1...v2020.38.0
[2020.37.1]: https://github.com/olivierlacan/keep-a-changelog/compare/v2020.37.0...v2020.37.1
[2020.37.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v2020.36.1...v2020.37.0
Expand Down
16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
## Versioning
We're using CalVer for versioning with the `YYYY.0W` format! I think we'll aim for Wednesday releases but that's tbd
We're using CalVer for versioning with the `YYYY.0W` format!

## Style
This is largely copied from Cog-Creators/Red-DiscordBot. I might change things eventually but this 'just works' for now.

Our style checker of choice, [black](https://github.com/ambv/black), actually happens to be an auto-formatter. The checking functionality simply detects whether or not it would try to reformat something in your code, should you run the formatter on it. For this reason, we recommend using this tool as a formatter, regardless of any disagreements you might have with the style it enforces.

Use the command `black --help` to see how to use this tool. The full style guide is explained in detail on [black's GitHub repository](https://github.com/ambv/black). **There is one exception to this**, however, which is that we set the line length to 99, instead of black's default 88. This is already set in `pyproject.toml` configuration file in the repo so you can simply format code with Black like so: `black <src>`.


## Commit Messages
We are using [Semantic Commit Messages](https://seesparkbox.com/foundry/semantic_commit_messages).

```
feat: add hat wobble
^--^ ^------------^
| |
| +-> Summary in present tense.
|
+-------> Type: chore, docs, deps, feat, fix, refactor, style, or test.
```
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
git+https://github.com/Ext-Creators/discord-ext-alternatives@5482a4e7a5387563fe1662ba95e22134572a369c#egg=discord-ext-alternatives
discord-ext-alternatives>=2020.10.11
humanize
PogoOCR==0.3.4
PogoOCR==0.3.6
python-dateutil
git+https://github.com/Kowlin/Red-DiscordBot@pr/guild-i18n#egg=Red-DiscordBot
trainerdex==3.6.1
Red-DiscordBot>=3.4.1,<3.5.0
git+https://github.com/TrainerDex/TrainerDex.py.git@release/3.7.0#trainerdex>=3.6.2,<3.8.0
2 changes: 1 addition & 1 deletion tdx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
__author__ = "TurnrDev"
__licence__ = "GNU-GPL"
__copyright__ = "Copyright 2020 TrainerDex/TurnrDev"
__version__ = "2020.40.2"
__version__ = "2020.48.0"
__red_end_user_data_statement__ = """We use several terms in this document which could be considered ambiguous so I would like to clear these up:
* the Website - any website hosted on the trainerdex.co.uk domain or any subdomains thereof
* the Discord Bot - Our official bot instance, TrainerDex#8522, on Discord, or any third party instances that may or may not launch in the future.
Expand Down
39 changes: 22 additions & 17 deletions tdx/converters.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import datetime
import contextlib
import logging
import re
from typing import Any, Union

import discord
from dateutil.parser import parse

import trainerdex as client
from redbot.core.i18n import Translator
from redbot.core import commands

logger: logging.Logger = logging.getLogger(__name__)
_ = Translator("TrainerDex", __file__)


Expand Down Expand Up @@ -51,6 +52,8 @@ def regex(self) -> str:
return r"[A-Za-z0-9]{3,15}$"

async def convert(self, ctx: commands.Context, argument: str) -> str:
logger.debug("NicknameConverter: argument: %s", argument)

match: Union[re.Match, None] = re.match(self.regex, argument)
if match is None:
raise commands.BadArgument(
Expand All @@ -76,20 +79,18 @@ async def convert(
argument: Union[str, discord.User, discord.Member],
cli: client.Client = client.Client(),
) -> client.Trainer:
logger.debug("TrainerConverter: argument: %s", argument)

mention = None
if isinstance(argument, str):
is_valid_nickname = await safe_convert(NicknameConverter, ctx, argument)
is_mention = await safe_convert(
discord.ext.commands.converter.UserConverter, ctx, argument
)
if is_valid_nickname:
try:
with contextlib.suppress(IndexError):
return await cli.search_trainer(argument)
except IndexError:
pass
mention = None

is_mention = await safe_convert(
discord.ext.commands.converter.UserConverter, ctx, argument
)
if is_mention:
mention = is_mention
elif isinstance(argument, (discord.User, discord.Member)):
Expand All @@ -113,6 +114,7 @@ def __init__(self):
}

async def convert(self, ctx: commands.Context, argument: str) -> client.Faction:
logger.debug("TeamConverter: argument: %s", argument)
if isinstance(argument, int) or argument.isnumeric():
if int(argument) in self.teams.keys():
result = client.Faction(int(argument))
Expand All @@ -136,6 +138,7 @@ async def convert(self, ctx: commands.Context, argument: str) -> client.Faction:

class LevelConverter(commands.Converter):
async def convert(self, ctx: commands.Context, argument: str) -> client.Level:
logger.debug("LevelConverter: argument: %s", argument)
try:
return client.update.get_level(level=int(argument))
except KeyError:
Expand All @@ -144,6 +147,7 @@ async def convert(self, ctx: commands.Context, argument: str) -> client.Level:

class TotalXPConverter(commands.Converter):
async def convert(self, ctx: commands.Context, argument: str) -> client.Level:
logger.debug("TotalXPConverter: argument: %s", argument)
if not argument.isdigit():
raise commands.BadArgument(_("Not a valid number."))
elif int(argument) < 100:
Expand All @@ -152,11 +156,12 @@ async def convert(self, ctx: commands.Context, argument: str) -> client.Level:
return int(argument)


class DatetimeConverter(commands.Converter):
async def convert(self, ctx: commands.Context, argument: str) -> datetime.datetime:
return parse(argument)


class DateConverter(DatetimeConverter):
async def convert(self, ctx: commands.Context, argument: str) -> datetime.date:
return await super().convert(ctx, argument).date()
class TrainerCodeValidator(commands.Converter):
async def convert(self, ctx: commands.Context, argument: str) -> str:
logger.debug("TrainerCodeValidator: argument: %s", argument)
if re.match(r"^(\d{4}[\s-]?){3}$", argument):
return re.sub(r"[\s-]", "", argument)
else:
raise commands.BadArgument(
_("Trainer Code must be 12 digits long and contain only numbers and whitespace.")
)
12 changes: 3 additions & 9 deletions tdx/embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from dateutil.rrule import rrule, WEEKLY
from dateutil.tz import UTC

log: logging.Logger = logging.getLogger(__name__)
logger: logging.Logger = logging.getLogger(__name__)
_ = Translator("TrainerDex", __file__)
config = Config.get_conf(
None,
Expand Down Expand Up @@ -45,6 +45,7 @@ async def __init__(self, ctx: commands.Context, **kwargs) -> None:
self.type: str = kwargs.get("type", "rich")
self.url: str = kwargs.get("url", EmptyEmbed)
self.description: str = kwargs.get("description", EmptyEmbed)
self.timestamp = kwargs.get("timestamp", EmptyEmbed)

notice: str = await config.notice()
if notice:
Expand All @@ -55,13 +56,6 @@ async def __init__(self, ctx: commands.Context, **kwargs) -> None:
else:
self.description: str = notice

try:
timestamp = kwargs["timestamp"]
except KeyError:
pass
else:
self.timestamp = timestamp

# Default _author
self._footer: Dict[str, str] = {
"text": await config.embed_footer(),
Expand Down Expand Up @@ -103,7 +97,7 @@ async def __init__(
try:
self.update = max(self.trainer.updates, key=check_xp)
except ValueError:
log.warning("No updates found for {user}".format(user=self.trainer))
logger.warning("No updates found for %(user)s", {"user": self.trainer})

self.colour: int = self.trainer.team.colour
self.title: str = _("{nickname} | TL{level}").format(
Expand Down
6 changes: 3 additions & 3 deletions tdx/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"end_user_data_statement": "We use several terms in this document which could be considered ambiguous so I would like to clear these up:\n * the Website - any website hosted on the trainerdex.co.uk domain or any subdomains thereof\n * the Discord Bot - Our official bot instance, TrainerDex#8522, on Discord, or any third party instances that may or may not launch in the future.\n\n By signing up to TrainerDex through any of the various methods such as; the Website, the Discord Bot or any of our other apps, present and future, you are agreeing to these Terms of Service. These terms of service are subject to change at any time.\n\n We, TrainerDex, have the right to save and store screenshots of your stats for future audits and verification. We reserve the right to deny a user access to TrainerDex at any time, however, we will always try to provide the reason to the user.\n\n The following rules/terms are in place and violation of these rules can result in termination of your profile and a permanent ban from the service;\n\n * No use of tools and/or apps to falsify your location in Pokémon Go\n * No use of any tools or software or other methods to falsify your screenshots before submitting them.\n * No submitting anybody else’s screenshots as your own\n * No knowingly submitting false data to TrainerDex\n\n We endeavour to be open with data. We have a public API for information such as your Pokémon Go profile data. As such, your data may be used on third party tools such as PokeNav.\n\n The types of information we may store on you include;\n * Various datapoints about your Pokémon Go profile, including username, team, start date and any of the badges information provided to us\n * Your first name, if provided\n * Your email address, if provided\n * Your Discord UID, if provided via the Website or via using the Discord Bot\n * Your Twitter UID, if provided via the Website\n * Your Facebook name, if provided via the Website\n\n It is within your right to request to be removed from TrainerDex or have your information hidden at any time. However, we are not responsible for third party services caching your public data.\n\n To request removal or to be hidden from TrainerDex, email <[email protected]> or message TurnrDev#0117 on Discord.",
"min_bot_version": "3.4.0",
"requirements": [
"git+https://github.com/TurnrDev/discord-ext-alternatives@patch-1#egg=discord-ext-alternatives",
"discord-ext-alternatives>=2020.10.11",
"humanize",
"PogoOCR==0.3.4",
"PogoOCR==0.3.6",
"python-dateutil",
"trainerdex==3.6.1"
"git+https://github.com/TrainerDex/TrainerDex.py.git@release/3.7.0#trainerdex>=3.6.2,<3.8.0"
]
}
4 changes: 2 additions & 2 deletions tdx/leaderboard.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
import os
import math
import os
from typing import Final, Optional, Union

import discord
Expand All @@ -17,7 +17,7 @@
from .embeds import BaseCard
from .utils import append_icon, loading

log: logging.Logger = logging.getLogger(__name__)
logger: logging.Logger = logging.getLogger(__name__)
POGOOCR_TOKEN_PATH: Final = os.path.join(os.path.dirname(__file__), "data/key.json")
_ = Translator("TrainerDex", __file__)

Expand Down
Loading

0 comments on commit a81f949

Please sign in to comment.