Toggle lint and Alpha release

Signed-off-by: Bobloy <alboblexloy@gmail.com>
pull/3/head
Bobloy 7 years ago
parent d467c8b24f
commit 8cca379d37

@ -6,7 +6,7 @@ Cog Function
| --- | --- | --- |
| ccrole | **Beta** | <details><summary>Create custom commands that also assign roles</summary>May have some bugs, please create an issue if you find any</details> |
| chatter | **Alpha** | <details><summary>Chat-bot trained to talk like your guild</summary>Missing some key features, but currently functional</details> |
| coglint | **Incomplete** | <details><summary>Error check code in python syntax posted to discord</summary>Still conceptual, no idea if it'll work</details> |
| coglint | **Alpha** | <details><summary>Error check code in python syntax posted to discord</summary>Works, but probably needs more turning to work for cogs</details> |
| fight | **Incomplete** | <details><summary>Organize bracket tournaments within discord</summary>Still in-progress, a massive project</details> |
| flag | **Incomplete** | <details><summary>Create temporary marks on users that expire after specified time</summary>Not yet ported to v3</details> |
| hangman | **Alpha** | <details><summary>Play a game of hangman</summary>Some visual glitches and needs more customization</details> |

@ -23,6 +23,7 @@ class CogLint:
self.path = str(cog_data_path(self)).replace('\\', '/')
self.do_lint = None
self.counter = 0
# self.answer_path = self.path + "/tmpfile.py"
@ -33,10 +34,18 @@ class CogLint:
@commands.command()
async def autolint(self, ctx: RedContext):
"""Toggles automatically linting code"""
curr = await self.config.lint()
self.do_lint = not curr
await self.config.lint.set(not curr)
await ctx.send("Autolinting is now set to {}".format(not curr))
@commands.command()
async def lint(self, ctx: RedContext, *, code):
"""Lint python code"""
"""Lint python code
Toggle autolinting with `[p]autolint`
"""
await self.lint_message(ctx.message)
await ctx.send("Hello World")
@ -59,6 +68,10 @@ class CogLint:
return pylint_stdout, pylint_stderr
async def lint_message(self, message):
if self.do_lint is None:
self.do_lint = await self.config.lint()
if not self.do_lint:
return
code_blocks = message.content.split('```')[1::2]
for c in code_blocks:

Loading…
Cancel
Save