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

add reason to approve & let addreason accept all #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
18 changes: 11 additions & 7 deletions suggestion/suggestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Suggestion(commands.Cog):
Per guild, as well as global, suggestion box voting system.
"""

__version__ = "1.7.1"
__version__ = "1.7.2"

def __init__(self, bot: Red):
self.bot = bot
Expand Down Expand Up @@ -150,9 +150,11 @@ async def approve(
ctx: commands.Context,
suggestion_id: int,
is_global: typing.Optional[bool],
*,
reason: typing.Optional[str],
):
"""Approve a suggestion."""
await self._finish_suggestion(ctx, suggestion_id, is_global, True, None)
"""Approve a suggestion. Reason is optional."""
await self._finish_suggestion(ctx, suggestion_id, is_global, True, reason)

@checks.admin()
@commands.command()
Expand Down Expand Up @@ -195,16 +197,18 @@ async def addreason(
channel = ctx.guild.get_channel(
await self.config.guild(ctx.guild).reject_id()
)
elif ctx.guild.get_channel(
await self.config.guild(ctx.guild).approve_id()
):
channel = ctx.guild.get_channel(
await self.config.guild(ctx.guild).approve_id()
)
else:
channel = ctx.guild.get_channel(
await self.config.guild(ctx.guild).suggest_id()
)
msg_id = await self.config.custom("SUGGESTION", server, suggestion_id).msg_id()
if msg_id != 0:
if not await self.config.custom(
"SUGGESTION", server, suggestion_id
).rejected():
return await ctx.send("This suggestion hasn't been rejected.")
if await self.config.custom("SUGGESTION", server, suggestion_id).reason():
return await ctx.send("This suggestion already has a reason.")
content, embed = await self._build_suggestion(
Expand Down