Skip to content

Commit

Permalink
Resolve merge conflicts and update pre-commit dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
NeuroAssassin committed Aug 4, 2023
2 parents a5adc49 + 75d9c45 commit 0d5eb7f
Show file tree
Hide file tree
Showing 54 changed files with 1,147 additions and 283 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ default_language_version:
exclude: ^.stubs/
repos:
- repo: https://github.com/psf/black
rev: '20.8b1'
rev: '23.7.0'
hooks:
- id: black
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker
rev: '1.0.1'
rev: 'v1.1.3'
hooks:
- id: black-disable-checker
- repo: https://github.com/pycqa/flake8
rev: '3.9.0'
rev: '6.1.0'
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.4.0
hooks:
# `.gitattributes` should technically already handle this
# but autocrlf can result in local files keeping the CRLF
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 NeuroAssassin
Copyright (c) 2018-Present NeuroAssassin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
4 changes: 2 additions & 2 deletions authgg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .authgg import AuthGG


def setup(bot):
bot.add_cog(AuthGG(bot))
async def setup(bot):
await bot.add_cog(AuthGG(bot))
30 changes: 27 additions & 3 deletions authgg/authgg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
"""
MIT License
Copyright (c) 2018-Present NeuroAssassin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from redbot.core.utils.predicates import MessagePredicate
from redbot.core.utils.chat_formatting import humanize_list, inline
from redbot.core import commands, Config, checks
from redbot.core import commands, Config
from typing import Optional
import discord
import asyncio
Expand Down Expand Up @@ -111,7 +135,7 @@ async def changepw(self, ctx, apikey: str, username: str, password: str):
"I was unable to delete your command message due to lack of perms. It is recommended to due so to prevent your user's password from getting leaked."
)

@checks.is_owner()
@commands.is_owner()
@authgg.group()
async def keys(self, ctx):
"""Manage API keys for auth.gg"""
Expand Down Expand Up @@ -159,7 +183,7 @@ async def _keys_list(self, ctx):
message = f"The following keys are currently registered: {humanize_list(list(map(inline, keys.keys())))}"
await ctx.send(message)

@checks.is_owner()
@commands.is_owner()
@authgg.group()
async def roles(self, ctx):
"""Control what roles have access to reseting a user's HWID"""
Expand Down
4 changes: 2 additions & 2 deletions color/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
)


def setup(bot):
bot.add_cog(Color(bot))
async def setup(bot):
await bot.add_cog(Color(bot))
39 changes: 31 additions & 8 deletions color/color.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
import functools
"""
MIT License
Copyright (c) 2018-Present NeuroAssassin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

import io
import re

import discord
from redbot.core import Config, checks, commands
from redbot.core import Config, commands

from colour import Color as col
from colour import rgb2hex
Expand Down Expand Up @@ -124,7 +147,7 @@ async def color(self, ctx):
"""Group command for color commands"""
pass

@checks.bot_has_permissions(embed_links=True)
@commands.bot_has_permissions(embed_links=True)
@color.command()
async def name(self, ctx, name):
"""Provides the hexadecimal value, RGB value and HSL value of a passed color. For example, pass `red` or `blue` as the name argument."""
Expand All @@ -136,7 +159,7 @@ async def name(self, ctx, name):
except (ValueError, AttributeError):
await ctx.send("That color is not recognized.")

@checks.bot_has_permissions(embed_links=True)
@commands.bot_has_permissions(embed_links=True)
@color.command()
async def hex(self, ctx, hexa: str):
"""Provides the RGB value and HSL value of a passed hexadecimal value. Hexadecimal value must in the format of something like `#ffffff` or `0xffffff` to be used."""
Expand All @@ -152,7 +175,7 @@ async def hex(self, ctx, hexa: str):
"Invalid formatting for the hexadecimal. Must be the hexadecimal value, with an optional `0x` or `#` in the beginning."
)

@checks.bot_has_permissions(embed_links=True)
@commands.bot_has_permissions(embed_links=True)
@color.command()
async def rgb(self, ctx, highest: int, r: float, g: float, b: float):
"""Provides the hexadecimal value and HSL value of the rgb value given. Each value must have a space between them. Highest argument must be 1 or 255, indicating the highest value of a single value (r, g, or b)."""
Expand All @@ -169,7 +192,7 @@ async def rgb(self, ctx, highest: int, r: float, g: float, b: float):
except (ValueError, AttributeError):
await ctx.send("That rgb number is not recognized.")

@checks.bot_has_permissions(embed_links=True)
@commands.bot_has_permissions(embed_links=True)
@color.command()
async def hsl(self, ctx, h: float, s: float, l: float):
"""Provides the hexadecimal value and the RGB value of the hsl value given. Each value must have a space between them."""
Expand All @@ -180,7 +203,7 @@ async def hsl(self, ctx, h: float, s: float, l: float):
except (ValueError, AttributeError):
await ctx.send("That hsl number is not recognized.")

@checks.bot_has_permissions(embed_links=True)
@commands.bot_has_permissions(embed_links=True)
@color.command()
async def decimal(self, ctx, decimal: int):
"""Provides the RGB value of the decimal value given."""
Expand All @@ -190,7 +213,7 @@ async def decimal(self, ctx, decimal: int):
except (ValueError, AttributeError):
await ctx.send("That decimal value is not recognized.")

@checks.admin()
@commands.admin()
@color.command()
async def msgshort(self, ctx, enable: bool):
"""Enable or disable the in-message shortcut.
Expand Down
4 changes: 2 additions & 2 deletions commandchart/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
)


def setup(bot):
bot.add_cog(CommandChart(bot))
async def setup(bot):
await bot.add_cog(CommandChart(bot))
30 changes: 28 additions & 2 deletions commandchart/commandchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,38 @@
This cog was also a cog requested by Yukirin on the cogboard (cogboard.red)."""

"""
MIT License
Copyright (c) 2018-Present NeuroAssassin
Copyright (c) 2016-present aikaterna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""


import heapq
import typing
from io import BytesIO

import discord
from redbot.core import checks, commands
from redbot.core import commands

import matplotlib
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -101,7 +127,7 @@ def create_chart(self, top, others, channel):
image_object.seek(0)
return image_object

@checks.bot_has_permissions(embed_links=True)
@commands.bot_has_permissions(embed_links=True)
@commands.guild_only()
@commands.command()
async def commandchart(
Expand Down
4 changes: 2 additions & 2 deletions cooldown/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .cooldown import Cooldown


def setup(bot):
bot.add_cog(Cooldown(bot))
async def setup(bot):
await bot.add_cog(Cooldown(bot))
37 changes: 32 additions & 5 deletions cooldown/cooldown.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
from redbot.core import commands, checks, Config
"""
MIT License
Copyright (c) 2018-Present NeuroAssassin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from redbot.core import commands, Config
from discord.ext import commands as dc
import asyncio
import time
Expand All @@ -10,7 +34,8 @@ class Cooldown(commands.Cog):
WARNING: Some cooldowns are meant to be in place, meaning that they should not be removed.
Any contributors to this cog are not at fault if it is used improperly, and is instead at
the fault of the person running the command. By installing this cog, you agree to these terms."""
the fault of the person running the command. By installing this cog, you agree to these terms.
"""

def __init__(self, bot):
self.bot = bot
Expand Down Expand Up @@ -39,7 +64,7 @@ async def initialize(self):
}
commands.cooldown(entry[1], entry[2], switch[entry[3]])(cmd)

@checks.is_owner()
@commands.is_owner()
@commands.group()
async def cooldown(self, ctx):
"""Group command for working with cooldowns for commands."""
Expand Down Expand Up @@ -75,7 +100,8 @@ async def add(self, ctx, rate: int, per, btype, *, command):
- Rate: how many times
- Per: during how long
- Type: for what type
- Command: for what command. Do not use a prefix, and does not work with aliases. Please pass the actual command for the alias if you wish."""
- Command: for what command. Do not use a prefix, and does not work with aliases. Please pass the actual command for the alias if you wish.
"""
ttype = None
per = per.lower()
np = per[:-1]
Expand Down Expand Up @@ -167,7 +193,8 @@ async def remove(self, ctx, *, command):
Please do note however: some commands are meant to have cooldowns. They may prevent something malicious from happening, or maybe your device from breaking or from being used too much. I (Neuro Assassin <@473541068378341376>) or any other contributor to this cog take no responsibility for any complications that may result because of this. Use at your own risk.
Note: Does not actually remove the command cooldown (undocumented), so instead it allows for the command to be run 100000 times every 1 second until the next boot up, where it will not be added (unless you are removing a cooldown from outside of this cog, then it will be kept after restart)."""
Note: Does not actually remove the command cooldown (undocumented), so instead it allows for the command to be run 100000 times every 1 second until the next boot up, where it will not be added (unless you are removing a cooldown from outside of this cog, then it will be kept after restart).
"""
cmd = self.bot.get_command(command)
if cmd == None or not str(cmd) == command:
return await ctx.send("Invalid command argument.")
Expand Down
2 changes: 1 addition & 1 deletion dashboard/abc/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ async def dashboard(self, ctx: commands.Context):


class DBMixin:
""" This is mostly here to easily mess with things... """
"""This is mostly here to easily mess with things..."""

c = dashboard
29 changes: 19 additions & 10 deletions dashboard/baserpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def unload(self):
for extension in self.extensions:
extension.unload()

async def build_cmd_list(self, cmd_list: List[commands.Command], details=True):
async def build_cmd_list(self, cmd_list: List[commands.Command], details=True, do_escape=True):
final = []
async for cmd in AsyncIter(cmd_list):
if details:
Expand All @@ -80,22 +80,31 @@ async def build_cmd_list(self, cmd_list: List[commands.Command], details=True):
if cmd.requires.privilege_level == PrivilegeLevel.BOT_OWNER:
continue
try:
details = {
"name": escape(f"{cmd.qualified_name} {cmd.signature}"),
"desc": escape(cmd.short_doc or ""),
"subs": [],
}
if do_escape:
details = {
"name": escape(f"{cmd.qualified_name} {cmd.signature}"),
"desc": escape(cmd.short_doc or ""),
"subs": [],
}
else:
details = {
"name": f"{cmd.qualified_name} {cmd.signature}",
"desc": cmd.short_doc or "",
"subs": [],
}
except ValueError:
continue
if isinstance(cmd, commands.Group):
details["subs"] = await self.build_cmd_list(cmd.commands)
details["subs"] = await self.build_cmd_list(cmd.commands, do_escape=do_escape)
final.append(details)
else:
if cmd.requires.privilege_level == PrivilegeLevel.BOT_OWNER:
continue
final.append(escape(cmd.qualified_name))
final.append(escape(cmd.qualified_name) if do_escape else cmd.qualified_name)
if isinstance(cmd, commands.Group):
final += await self.build_cmd_list(cmd.commands, details=False)
final += await self.build_cmd_list(
cmd.commands, details=False, do_escape=do_escape
)
return final

def get_perms(self, guildid: int, m: discord.Member):
Expand Down Expand Up @@ -191,7 +200,7 @@ async def get_commands(self):
if not c.parent:
stripped.append(c)

cmds = await self.build_cmd_list(stripped)
cmds = await self.build_cmd_list(stripped, do_escape=False)
if not cmds:
continue

Expand Down
Loading

0 comments on commit 0d5eb7f

Please sign in to comment.