Skip to content

Commit

Permalink
Red 3.5 - Add new features to some cogs (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexed01 committed May 4, 2023
1 parent 7b3c36e commit 701ec47
Show file tree
Hide file tree
Showing 176 changed files with 2,024 additions and 4,202 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
python_version:
- "3.8"
- "3.9"
- "3.11"
tox_env:
- style-black
- style-isort
Expand All @@ -40,17 +40,17 @@ jobs:

name: Tox - ${{ matrix.python_version }} - ${{ matrix.friendly_name }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: ${{ env.ref }}
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}

# caching cuts down time for tox (for example black) from ~40 secs to 4
- name: Cache tox
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .tox
key: tox-${{ matrix.python_version }}-${{ matrix.tox_env }}-${{ hashFiles('tox.ini') }}
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/loadcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,26 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9"]
red-version:
# this workflow required pr #5453 commit d27dbde, which is in dev & pypi 3.4.15+
- "git+https://github.com/Cog-Creators/Red-DiscordBot@V3/develop#egg=Red-DiscordBot"
- "Red-DiscordBot==3.4.16"
python-version: ["3.8", "3.11"]
include:
- red-version: "git+https://github.com/Cog-Creators/Red-DiscordBot@V3/develop#egg=Red-DiscordBot"
friendly-red: "Red (dev version)"
- red-version: "Red-DiscordBot==3.4.16"
friendly-red: "Red 3.4.16"
- red-version: "Red-DiscordBot==3.4.19"
friendly-red: "Red 3.4.19"
fail-fast: false

name: Cog load test - Python ${{ matrix.python-version }} & ${{ matrix.friendly-red }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache venv
id: cache-venv
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: .venv
key: ${{ matrix.red-version }}-${{ matrix.python-version }}-${{ hashFiles('dev-requirements.txt') }}-${{ secrets.CACHE_V }}
Expand Down Expand Up @@ -62,7 +58,7 @@ jobs:

- name: Save Red output as Artifact
if: always() # still run if prev step failed
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: "Red log - Python ${{ matrix.python-version }} & ${{ matrix.friendly-red }}"
path: red.log
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8"]
python-version: ["3.11"]

name: Release
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11

- name: Install dependencies
run: |
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/scripts/loadcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,19 @@
# let Red boot up
time.sleep(10)

# not compatible with dpy 1.x
# ["buttonpoll", "ghissues"]

cogs = [
"aliases",
"anotherpingcog",
"beautify",
"betteruptime",
"buttonpoll",
"birthday",
"calc",
"caseinsensitive",
"cmdlog",
"covidgraph",
"fivemstatus",
"github",
"googletrends",
"ghissues",
"madtranslate",
"roleplay",
"stattrack",
Expand All @@ -53,10 +51,6 @@
"timechannel",
"uptimeresponder",
"wol",
# dpy 2 cogs:
# "buttonpoll",
# "ghissues",
# "calc",
]


Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/scripts/syncutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@
"calc",
"caseinsensitive",
"cmdlog",
"covidgraph",
"fivemstatus",
"github",
"googletrends",
"ghissues",
"madtranslate",
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/syncutils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8"]
python-version: ["3.11"]

name: Sync utils
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pip install gitpython requests
- name: Install dependencies
run: |
pip install gitpython requests
- name: Run script syncutils.py
run: |
python .github/workflows/scripts/syncutils.py
env:
CF_KV: ${{ secrets.CF_KV}}
- name: Run script syncutils.py
run: |
python .github/workflows/scripts/syncutils.py
env:
CF_KV: ${{ secrets.CF_KV}}

- name: "Commit and push changes"
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automated utils sync
- name: "Commit and push changes"
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automated utils sync
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ There's a list of cogs below, or you can use `[p]cog list vex-cogs` if you've ad
| [beautify](https://go.vexcodes.com/c/beautify) | Beautify and minify JSON. |
| [betteruptime](https://go.vexcodes.com/c/betteruptime) | See your bot's uptime percentages and check when downtime happened. |
| [birthday](https://go.vexcodes.com/c/birthday) | Birthday cog with customisable messages and roles. |
| [buttonpoll](https://go.vexcodes.com/c/buttonpoll) | Create polls with buttons! |
| [calc](https://go.vexcodes.com/c/calc) | A simple button-based calculator. |
| [caseinsensitive](https://go.vexcodes.com/c/caseinsensitive) | Make all prefixes and commands case insensitive. |
| [cmdlog](https://go.vexcodes.com/c/cmdlog) | Track command usage, searchable by user, server or command name. |
| [covidgraph](https://go.vexcodes.com/c/covidgraph) | Get graphs of COVID-19 data. |
| [fivemstatus](https://go.vexcodes.com/c/fivemstatus) | View the live status of a FiveM server, in a updating Discord message. |
| [github](https://go.vexcodes.com/c/github) | Create, comment, labelify and close GitHub issues, with partial PR support. |
| [ghissues](https://go.vexcodes.com/c/ghissues) | Create, comment, labelify and close GitHub issues, with some PR support. |
| [googletrends](https://go.vexcodes.com/c/googletrends) | Find out what the world is searching, right from Discord. |
| [madtranslate](https://go.vexcodes.com/c/madtranslate) | Translate text through lots of languages. Get some funny results! |
| [roleplay](https://go.vexcodes.com/c/roleplay) | Create an anonymous role play in your server. |
Expand Down
4 changes: 1 addition & 3 deletions aliases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@ async def setup(bot: Red) -> None:
cog = Aliases(bot)
await out_of_date_check("aliases", cog.__version__)

r = bot.add_cog(cog)
if r is not None:
await r
await bot.add_cog(cog)
3 changes: 1 addition & 2 deletions aliases/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"description": "Get all the information you could ever need about a command's aliases. IF YOU ARE TRYING TO *MAKE* ALIASES, JUST USE THE CORE 'alias` COG.",
"end_user_data_statement": "This cog does not persistently store data or metadata about users.",
"install_msg": "\\N{WARNING SIGN}\\N{VARIATION SELECTOR-16}\nThis cog reads the config of the alias cog. This means it might break without much notice.\n\nIf you are just trying to **make aliases**: this cog isn't for that. Use the core `alias` cog to make and manage aliases with the `[p]load alias` command, then `[p]help alias`.\n\nThis cog has docs! Check them out at <https://go.vexcodes.com/c/aliases>",
"max_bot_version": "3.6.0.dev0",
"min_bot_version": "3.4.0",
"min_bot_version": "3.5.1",
"min_python_version": [
3,
8,
Expand Down
9 changes: 5 additions & 4 deletions aliases/vexutils/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

import asyncio
import json
from logging import Logger, getLogger
from pathlib import Path
from typing import Literal, NamedTuple

import aiohttp
from red_commons.logging import RedTraceLogger
from red_commons.logging import getLogger as red_get_logger
from redbot.core import VersionInfo, commands
from redbot.core import version_info as cur_red_version
from rich import box as rich_box
Expand All @@ -16,13 +17,13 @@
from .consts import DOCS_BASE, GREEN_CIRCLE, RED_CIRCLE
from .loop import VexLoop

log = getLogger("red.vex-utils")
log = red_get_logger("red.vex-utils")


cog_ver_lock = asyncio.Lock()


def get_vex_logger(name: str) -> Logger:
def get_vex_logger(name: str) -> RedTraceLogger:
"""Get a logger for the given name.
Parameters
Expand All @@ -42,7 +43,7 @@ def get_vex_logger(name: str) -> Logger:
else: # otherwise use full path
final_name += name

return getLogger(final_name)
return red_get_logger(final_name)


def format_help(self: commands.Cog, ctx: commands.Context) -> str:
Expand Down
Loading

0 comments on commit 701ec47

Please sign in to comment.