mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 09:22:31 -05:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3bff7e87c | ||
|
|
4b19421075 | ||
|
|
cf371e8093 | ||
|
|
5eeadc6399 | ||
|
|
f6823ea3d1 | ||
|
|
f24290c423 | ||
|
|
f8a36885fe | ||
|
|
a555eff2cc | ||
|
|
05c389623c | ||
|
|
bf00f5e9a2 |
@@ -19,6 +19,15 @@ import logging.handlers
|
||||
import logging
|
||||
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
|
||||
|
||||
@@ -635,7 +635,7 @@ class Permissions:
|
||||
stil_valid = [
|
||||
(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:
|
||||
"""
|
||||
|
||||
@@ -36,5 +36,5 @@ class VersionInfo:
|
||||
return [self.major, self.minor, self.micro, self.releaselevel, self.serial]
|
||||
|
||||
|
||||
__version__ = "3.0.0b17"
|
||||
version_info = VersionInfo(3, 0, 0, "beta", 17)
|
||||
__version__ = "3.0.0b18"
|
||||
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:
|
||||
return amount <= 0
|
||||
return amount < 0
|
||||
|
||||
|
||||
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):
|
||||
raise ValueError("Invalid withdrawal amount {} <= 0".format(amount))
|
||||
raise ValueError("Invalid withdrawal amount {} < 0".format(amount))
|
||||
|
||||
bal = await get_balance(member)
|
||||
if amount > bal:
|
||||
|
||||
@@ -84,7 +84,7 @@ class Dev:
|
||||
author - command author's member object
|
||||
message - the command's message object
|
||||
discord - discord.py library
|
||||
commands - discord.py commands extension
|
||||
commands - redbot.core.commands
|
||||
_ - The result of the last dev command.
|
||||
"""
|
||||
env = {
|
||||
@@ -138,7 +138,7 @@ class Dev:
|
||||
author - command author's member object
|
||||
message - the command's message object
|
||||
discord - discord.py library
|
||||
commands - discord.py commands extension
|
||||
commands - redbot.core.commands
|
||||
_ - The result of the last dev command.
|
||||
"""
|
||||
env = {
|
||||
|
||||
@@ -407,20 +407,24 @@ async def help(ctx, *cmds: str):
|
||||
max_pages_in_guild = await ctx.bot.db.help.max_pages_in_guild()
|
||||
if len(embeds) > max_pages_in_guild:
|
||||
destination = ctx.author
|
||||
|
||||
for embed in embeds:
|
||||
if use_embeds:
|
||||
try:
|
||||
await destination.send(embed=embed)
|
||||
except discord.HTTPException:
|
||||
destination = ctx.author
|
||||
await destination.send(embed=embed)
|
||||
else:
|
||||
try:
|
||||
await destination.send(embed)
|
||||
except discord.HTTPException:
|
||||
destination = ctx.author
|
||||
await destination.send(embed)
|
||||
try:
|
||||
for embed in embeds:
|
||||
if use_embeds:
|
||||
try:
|
||||
await destination.send(embed=embed)
|
||||
except discord.HTTPException:
|
||||
destination = ctx.author
|
||||
await destination.send(embed=embed)
|
||||
else:
|
||||
try:
|
||||
await destination.send(embed)
|
||||
except discord.HTTPException:
|
||||
destination = ctx.author
|
||||
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
|
||||
|
||||
@@ -11,8 +11,8 @@ from pathlib import Path
|
||||
|
||||
log = logging.getLogger("red")
|
||||
|
||||
PRETTY = {"indent": 4, "sort_keys": True, "separators": (",", " : ")}
|
||||
MINIFIED = {"sort_keys": True, "separators": (",", ":")}
|
||||
PRETTY = {"indent": 4, "sort_keys": False, "separators": (",", " : ")}
|
||||
MINIFIED = {"sort_keys": False, "separators": (",", ":")}
|
||||
|
||||
|
||||
class JsonIO:
|
||||
|
||||
4
tox.ini
4
tox.ini
@@ -13,7 +13,7 @@ envlist =
|
||||
description = Run unit tests with pytest
|
||||
extras = voice, test, mongo
|
||||
deps =
|
||||
https://github.com/Rapptz/discord.py/archive/rewrite.zip#egg=discord.py[voice]
|
||||
https://github.com/Rapptz/discord.py/archive/7eb918b19e3e60b56eb9039eb267f8f3477c5e17.zip#egg=discord.py[voice]
|
||||
-rrequirements.txt
|
||||
commands =
|
||||
python -m compileall ./redbot/cogs
|
||||
@@ -26,7 +26,7 @@ basepython = python3.6
|
||||
extras = voice, docs, mongo
|
||||
commands =
|
||||
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]
|
||||
description = Stylecheck the code with black to see if anything needs changes.
|
||||
|
||||
Reference in New Issue
Block a user