mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 01:12:33 -05:00
Compare commits
9 Commits
3.0.0b17.p
...
3.0.0b18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3bff7e87c | ||
|
|
4b19421075 | ||
|
|
cf371e8093 | ||
|
|
5eeadc6399 | ||
|
|
f6823ea3d1 | ||
|
|
f24290c423 | ||
|
|
f8a36885fe | ||
|
|
a555eff2cc | ||
|
|
05c389623c |
@@ -19,6 +19,15 @@ import logging.handlers
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
# Let's not force this dependency, uvloop is much faster on cpython
|
||||||
|
if sys.implementation.name == "cpython":
|
||||||
|
try:
|
||||||
|
import uvloop
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Red - Discord Bot v3
|
# Red - Discord Bot v3
|
||||||
|
|||||||
@@ -635,7 +635,7 @@ class Permissions:
|
|||||||
stil_valid = [
|
stil_valid = [
|
||||||
(k, v) for k, v in self.cache.items() if not any(obj in k for obj in to_invalidate)
|
(k, v) for k, v in self.cache.items() if not any(obj in k for obj in to_invalidate)
|
||||||
]
|
]
|
||||||
self.cache = LRUDict(*stil_valid, size=self.cache.size)
|
self.cache = LRUDict(stil_valid, size=self.cache.size)
|
||||||
|
|
||||||
def find_object_uniquely(self, info: str) -> int:
|
def find_object_uniquely(self, info: str) -> int:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -36,5 +36,5 @@ class VersionInfo:
|
|||||||
return [self.major, self.minor, self.micro, self.releaselevel, self.serial]
|
return [self.major, self.minor, self.micro, self.releaselevel, self.serial]
|
||||||
|
|
||||||
|
|
||||||
__version__ = "3.0.0b17"
|
__version__ = "3.0.0b18"
|
||||||
version_info = VersionInfo(3, 0, 0, "beta", 17)
|
version_info = VersionInfo(3, 0, 0, "beta", 18)
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ async def set_balance(member: discord.Member, amount: int) -> int:
|
|||||||
|
|
||||||
|
|
||||||
def _invalid_amount(amount: int) -> bool:
|
def _invalid_amount(amount: int) -> bool:
|
||||||
return amount <= 0
|
return amount < 0
|
||||||
|
|
||||||
|
|
||||||
async def withdraw_credits(member: discord.Member, amount: int) -> int:
|
async def withdraw_credits(member: discord.Member, amount: int) -> int:
|
||||||
@@ -217,7 +217,7 @@ async def withdraw_credits(member: discord.Member, amount: int) -> int:
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
if _invalid_amount(amount):
|
if _invalid_amount(amount):
|
||||||
raise ValueError("Invalid withdrawal amount {} <= 0".format(amount))
|
raise ValueError("Invalid withdrawal amount {} < 0".format(amount))
|
||||||
|
|
||||||
bal = await get_balance(member)
|
bal = await get_balance(member)
|
||||||
if amount > bal:
|
if amount > bal:
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class Dev:
|
|||||||
author - command author's member object
|
author - command author's member object
|
||||||
message - the command's message object
|
message - the command's message object
|
||||||
discord - discord.py library
|
discord - discord.py library
|
||||||
commands - discord.py commands extension
|
commands - redbot.core.commands
|
||||||
_ - The result of the last dev command.
|
_ - The result of the last dev command.
|
||||||
"""
|
"""
|
||||||
env = {
|
env = {
|
||||||
@@ -138,7 +138,7 @@ class Dev:
|
|||||||
author - command author's member object
|
author - command author's member object
|
||||||
message - the command's message object
|
message - the command's message object
|
||||||
discord - discord.py library
|
discord - discord.py library
|
||||||
commands - discord.py commands extension
|
commands - redbot.core.commands
|
||||||
_ - The result of the last dev command.
|
_ - The result of the last dev command.
|
||||||
"""
|
"""
|
||||||
env = {
|
env = {
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ async def help(ctx, *cmds: str):
|
|||||||
max_pages_in_guild = await ctx.bot.db.help.max_pages_in_guild()
|
max_pages_in_guild = await ctx.bot.db.help.max_pages_in_guild()
|
||||||
if len(embeds) > max_pages_in_guild:
|
if len(embeds) > max_pages_in_guild:
|
||||||
destination = ctx.author
|
destination = ctx.author
|
||||||
|
try:
|
||||||
for embed in embeds:
|
for embed in embeds:
|
||||||
if use_embeds:
|
if use_embeds:
|
||||||
try:
|
try:
|
||||||
@@ -421,6 +421,10 @@ async def help(ctx, *cmds: str):
|
|||||||
except discord.HTTPException:
|
except discord.HTTPException:
|
||||||
destination = ctx.author
|
destination = ctx.author
|
||||||
await destination.send(embed)
|
await destination.send(embed)
|
||||||
|
except discord.Forbidden:
|
||||||
|
await ctx.channel.send(
|
||||||
|
"I couldn't send the help message to you in DM. Either you blocked me or you disabled DMs in this server."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@help.error
|
@help.error
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ from pathlib import Path
|
|||||||
|
|
||||||
log = logging.getLogger("red")
|
log = logging.getLogger("red")
|
||||||
|
|
||||||
PRETTY = {"indent": 4, "sort_keys": True, "separators": (",", " : ")}
|
PRETTY = {"indent": 4, "sort_keys": False, "separators": (",", " : ")}
|
||||||
MINIFIED = {"sort_keys": True, "separators": (",", ":")}
|
MINIFIED = {"sort_keys": False, "separators": (",", ":")}
|
||||||
|
|
||||||
|
|
||||||
class JsonIO:
|
class JsonIO:
|
||||||
|
|||||||
2
tox.ini
2
tox.ini
@@ -26,7 +26,7 @@ basepython = python3.6
|
|||||||
extras = voice, docs, mongo
|
extras = voice, docs, mongo
|
||||||
commands =
|
commands =
|
||||||
sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" -W -bhtml
|
sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" -W -bhtml
|
||||||
sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" -W -blinkcheck
|
# sphinx-build -d "{toxworkdir}/docs_doctree" docs "{toxworkdir}/docs_out" -W -blinkcheck
|
||||||
|
|
||||||
[testenv:style]
|
[testenv:style]
|
||||||
description = Stylecheck the code with black to see if anything needs changes.
|
description = Stylecheck the code with black to see if anything needs changes.
|
||||||
|
|||||||
Reference in New Issue
Block a user