Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with Autopep8 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions cogs/skyloader.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ______ __ __ __ __ ______ ______
# /\ ___\ /\ \/ / /\ \_\ \ /\ ___\ /\ == \
# \ \___ \ \ \ _--. \ \____ \ \ \___ \ \ \ __<
# ______ __ __ __ __ ______ ______
# /\ ___\ /\ \/ / /\ \_\ \ /\ ___\ /\ == \
# \ \___ \ \ \ _--. \ \____ \ \ \___ \ \ \ __<
# \/\_____\ \ \_\ \_\ \/\_____\ \/\_____\ \ \_____\
# \/_____/ \/_/\/_/ \/_____/ \/_____/ \/_____/
#
#
# AGPL-3.0 license

import requests
Expand All @@ -27,20 +27,20 @@ def __init__(self, bot):
)
async def unloadExt(self, ctx, *, name: str):
await answer(ctx, self.langpack['unloadExt']['wait'].format(ext_name), delete=False)

if os.path.exists(f"./cogs/{name}.py"):
await answer(ctx, self.langpack['unloadExt']['errorsystem'])
return

if not os.path.exists(f"./modules/custom/{name}.py"):
await answer(ctx, self.langpack['unloadExt']['notfound'])
return

await bot.unload_extension(f"cogs.custom.{name}")
os.remove("./cogs/custom/{name}.py")

await answer(ctx, self.langpack['unloadExt']['done'].format(name))

@skySB.command(
aliases=["lm", "install", "le"],
description=langs.getcurrent()['loader']['loadExt']['description']
Expand All @@ -51,22 +51,22 @@ async def loadExt(self, ctx, *, url: str):
if not validators.Link(url):
await answer(ctx, self.langpack['loadExt']['errorlink'])
return

resp = requests.get(url)
if not resp.ok:
await answer(ctx, self.langpack['loadExt']['errorresp'])
return

if os.path.exists(f"./cogs/custom/{ext_name}.py"):
await answer(ctx, self.langpack['loadExt']['errorexists'])
return

with open(f"./cogs/custom/{ext_name}.py", "wb") as f:
f.write(resp.content)

await bot.load_extension(f"cogs.custom.{ext_name}")
await answer(ctx, self.langpack['loadExt']['done'].format(ext_name))

@skySB.command(
aliases=["reload", "rl", "reloadcogs"],
description=langs.getcurrent()['loader']['reloadExt']['description']
Expand All @@ -79,12 +79,13 @@ async def reloadExt(self, ctx):
extension = file[:-3]
try:
await self.bot.reload_extension(f"cogs.{extension}")
msg += self.langpack['reloadExt']['format'].format(extension)
msg += self.langpack['reloadExt']['format'].format(
extension)
except:
pass

await answer(ctx, msg)


async def setup(bot):
await bot.add_cog(Loader(bot))
await bot.add_cog(Loader(bot))
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async def answer(
"""
responses = []
if len(message) > 2000:
chunks = [message[i : i + 2000] for i in range(0, len(message), 2000)]
chunks = [message[i: i + 2000] for i in range(0, len(message), 2000)]
for chunk in chunks:
responses.append(await ctx.reply(chunk))
else:
Expand Down