-
Notifications
You must be signed in to change notification settings - Fork 8
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
Added toggle for Verify, new default behaviour for welcome message and k!setup #232
base: master
Are you sure you want to change the base?
Conversation
test: added test for introcog without message
…into WERemoveCog
Fixed: SQL Insertion error, if statement was set up wrong Signed-off-by: Jonathan <[email protected]>
Signed-off-by: Jonathan <[email protected]>
…error dialogue Signed-off-by: Jonathan <[email protected]>
Signed-off-by: Jonathan <[email protected]>
…into WERemoveCog
Signed-off-by: Jonathan <[email protected]>
Signed-off-by: Jonathan <[email protected]>
…with database management Signed-off-by: Jonathan <[email protected]>
Signed-off-by: Jonathan <[email protected]>
Signed-off-by: Jonathan <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #232 +/- ##
==========================================
+ Coverage 82.26% 83.26% +0.99%
==========================================
Files 26 26
Lines 6452 6973 +521
==========================================
+ Hits 5308 5806 +498
- Misses 1144 1167 +23
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
This pull request introduces 1 alert when merging af59bbb into 85c3be5 - view on LGTM.com new alerts:
|
Signed-off-by: Jonathan <[email protected]>
This pull request introduces 1 alert when merging 721174e into 85c3be5 - view on LGTM.com new alerts:
|
{ | ||
"command": "setup", | ||
"parameters": [] | ||
"description": "Allows access to configure the bot, once legal terms are agreed" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make sure the colon is kept in there, also need to add back in the comma on the line above (52)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
documentation.json
Outdated
{ | ||
"command": "verifyDM", | ||
"parameters": ["toggle"] | ||
"description" "Toggle the verify DM for a guild, that sends the user a list of emails to verify" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make sure the colon is there between "description" and "Toggle ...", also need to add back in the comma on the line above (347)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
sql_create_guild_dm_email_list_status_table = """ | ||
CREATE TABLE IF NOT EXISTS GuildDMEmailListStatus( | ||
guild_id integer NOT NULL PRIMARY KEY, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to be changed to text later down the line. Same thing on 136
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guild_id integer NOT NULL PRIMARY KEY, | |
guild_id text NOT NULL PRIMARY KEY, | |
sql_create_guild_setup_table = """ | ||
CREATE TABLE IF NOT EXISTS GuildSetupStatus( | ||
guild_id integer NOT NULL PRIMARY KEY, | ||
accepted_setup BOOLEAN NOT NULL CHECK (accepted_setup IN (0, 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth DEFAULT ing this?
guild_id = ?""" | ||
self.db_execute_commit(sql_update_dm_email_list_status, args=[toggle, guild_id]) | ||
|
||
def remove_dm_email_list_status(self, guild_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible can you create tests for these new methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This pull request introduces 1 alert when merging ea4bb34 into d666525 - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging 7850f15 into d666525 - view on LGTM.com new alerts:
|
This pull request introduces 2 alerts when merging b5f2a40 into 1b3210f - view on LGTM.com new alerts:
|
Please remove the unused imports specified by LGTM |
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple things to change, also need to check if setup is required for all our commands.
Also need to actually make the terms and conditions, as we currently only have a privacy policy.
Also need to check if privacy policy should be agreed to within setup. But in the meantime there are some things to change
@@ -3,6 +3,12 @@ All notable changes to KoalaBot will be documented in this file. | |||
A lot of these commands will only be available to administrators | |||
|
|||
## [Unreleased] | |||
### 29-07-2021 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog should be in the same format as previously. Use subheadings for different Cogs/ base KoalaBot, and 'other' for anything else mainly dev related
@@ -97,6 +97,13 @@ def is_admin(ctx): | |||
return ctx.author.guild_permissions.administrator or is_dpytest | |||
|
|||
|
|||
def terms_agreed(ctx): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -160,6 +167,16 @@ async def on_command_error(ctx, error): | |||
elif isinstance(error, commands.CommandOnCooldown): | |||
await ctx.send(embed=error_embed(description=f"{ctx.author.mention}, this command is still on cooldown for " | |||
f"{str(error.retry_after)}s.")) | |||
elif isinstance(error, commands.CheckFailure): | |||
if database_manager.fetch_guild_setup_status(ctx.guild.id) == 0: | |||
await ctx.send(embed=error_embed(description="In order to use this command. You must agree to the Terms & Conditions " \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error doesn't seem to show up. Instead nothing is sent to the user. needs fixing
"For legal documents relating to this, please view the following link: http://legal.koalabot.uk/ " \ | ||
"Use k!setup to agree" | ||
for channel in guild.text_channels: | ||
if channel.permissions_for(guild.me).send_messages: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it doesn't have access, what happens? Also this would be very infuriating to most people as when joining KoalaBot may post in a public announcement channel. Instead it would be best to DM the user that invited Koala, or just wait to send this message when a Koala command is sent in any channel, and respond with this instead
KoalaBot.logger.info(f"KoalaBot joined new guild, id = {guild.id}, name = {guild.name}.") | ||
await self.send_setup_message(guild) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to the failed terms agreed check
DBManager.insert_setup_status(guild.id) | ||
DBManager.update_guild_setup_status(guild.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can these be added to a pytest fixture?
@@ -129,13 +131,123 @@ def create_base_tables(self): | |||
welcome_message text | |||
);""" | |||
|
|||
sql_create_guild_setup_table = """ | |||
CREATE TABLE IF NOT EXISTS GuildSetupStatus( | |||
guild_id integer NOT NULL PRIMARY KEY, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change IDs to text
|
||
sql_create_guild_dm_email_list_status_table = """ | ||
CREATE TABLE IF NOT EXISTS GuildDMEmailListStatus( | ||
guild_id integer NOT NULL PRIMARY KEY, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guild_id integer NOT NULL PRIMARY KEY, | |
guild_id text NOT NULL PRIMARY KEY, | |
sql_create_guild_dm_email_list_status_table = """ | ||
CREATE TABLE IF NOT EXISTS GuildDMEmailListStatus( | ||
guild_id integer NOT NULL PRIMARY KEY, | ||
dm_email_list_status BOOLEAN NOT NULL CHECK (dm_email_list_status IN (0, 1)) | ||
); | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be moved to Verification.py?
removal of line as per @JayDwee's suggestion Co-authored-by: Jack Draper <[email protected]>
Summary
close #86
This PR, adds a toggle for verification using k!verifyDM .
Added new default behaviour for welcome messages, they do not happen by default unless one is updated with a welcome message.
Added k!setup command, this blocks all possible sensitive commands until the command is called in the guild by an admin
Checklist
CHANGELOG.md
under the[Unreleased]
heading?documentation.json
?