Skip to content

Commit

Permalink
[pull] master from kyb3r:master (#70)
Browse files Browse the repository at this point in the history
* Sending files in threads (non-images) now work. resolves modmail-dev#2926

* Deleting messages no longer shows a false error, resolves modmail-dev#2910

* Linting

* Fix `?perms get` command showing IDs instead of user or role mentions.

* Support discord.py v1.6 & LOTTIE stickers

* Release v3.8

* Linting & Changelog

* Fix bug when sending multiple images at once.

* Fix error when reacting on confirm thread creation message.

* Update changelog

* Autotriggers no longer sends attachments back. resolves modmail-dev#2932

* Fix `logs` command without argument in thread channel when the recipient is not cached.

* Fix error raised when recipient is not cached and reacts to reactions in DM channel.

* Fixed bug with update notifiations

* Retry with diff name if channel cant be created resolves modmail-dev#2934

* Retrieve user from Discord API if user has left the server, modmail-dev#2935 modmail-dev#2936

* IDs in `<member>` commands work now.

* update version in discord version error string

* Hotfix: Corrupted data no longer saved to thread cache

* Bump version

* 3.8.4 - Another fix attempt

* Improved cache saving methods

* Ability to disable mention on thread creation.

* Update thread move message in case `mention` was set to disable/None.

* Formatting...

* Apply suggestions from code review

Co-authored-by: Jia Rong Yee <28086837+fourjr@users.noreply.github.com>

* Fix typo in 'config_help.json' (modmail-dev#2957)

* Update README.md (modmail-dev#2955)

fix a sentence which said to join the old deleted plugin server

* Add msglink command to get DM message URLs.

* Add DM channel ID to genesis message footer.

* Amend typo and black formatting.

* Improve messages

* Changelog update

* Non-master/development branch deployments no longer cause erros to be raised.

* Update changelog

* Fix bug where autotriggers are in dm context, resolve modmail-dev#2961

* Use the ID attribute of DM Channel.

Originally used the channel instance by mistake, causing the `__str__` to be used instead of the intended ID.

* Confirm thread creation when user opens a thread using react to contact.

* Block new thread from react to contact when Modmail DM is disabled (new or all).

* Bot will not attempt to find for linked message when the recipient reacts to reactions on confirm thread creation message.

* Fix previous commit.

* Fix a few bad refs and typos

* Add local plugins

* Add local plugin dir

* Add local plugins

* Updated version, deps, and plugins code

* Forgot to finish sentence

* new plugin

A little plugin I was working on

* Potentially breaking: improved plugin events

* Fix bug where cancelled still attempts to start thread

* Changelog & Ghost errors are no longer raised when threads are created using non-organic methods.

* Add reaciton menu plugin

* better run command, 3.9.1

* add music plugin

added music plugin on taki's request

* Update registry.json

try to fix install issue

* Update bot.py

add hosting methods: screen and systemd

* Update models.py

add hosting methods: screen and systemd

* Force update dev? Weird history

* Add docker hostingmethod

* Update config_help.json

Change disabled to enabled, as it is enabled on a new bot creation

* Bump versions

* Update readme

* did i not commit this

* Update `mention` command.

* Add Coolguy (Prime Servers) to SPONSORS

* Small correction

* Add Coolguy (Prime Servers) to SPONSORS

* Update to HTTPS

* Update to HTTPS

* v3.9.3 add use_user_id_channel_name

* black

* Possibly fix emoji problem

* Cleaner code :D

* Bump python runtime version

Security update

* Update sponsors

* Add docker-compose configuration for self hosting

Adds a docker-compose configuration file for running both the bot and logviewer with a shared mongo database in a single container stack.

Exposes port 8000 and ensure the mongo database can not be accessed remotely.

* Change Max Channel per Category to 49, fix fallback save logic

* There is now a proper message when trying to contact a bot.

* Changelog - v3.9.4

* Fix typo

* add fourjr claim

* Add volume for persistent data storage to Mongo

* Update pyproject.toml

* Update README.md

* Update sponsors

* Fix typo in config help.

* Update 'bot.py' and 'clients.py':
- Fix return types, type hints, and unresolved references.

* Update database after resetting/purging all plugins.

* `plugin reset`, remove unloaded plugins from `self.loaded_plugins`

* turn mentions into set

* Hopefully resolves modmail-dev#3022.

* Improve contact and react to contact:
- Checks if user is blocked when `?contact` command or react to contact is used.

* Remove publish plugin

* Initial 3.9.5-dev1

* Update registry.json

removal of profanity filter, trying to download will result in a infinite download loop and will stop any plugin from loading/break the usage of removing/adding new plugins

* Group conversation ALPHA modmail-dev#143

* Remove debug

* Push ver

* Fix closes for group conversations

* Bump version

* Update registry.json

* Changelog

* Add solution to CERTIFICATE_VERIFY_FAILED

* New issue forms

* formatting

* Update SPONSORS.json

* fix issue template

* Update requirements system and removed poetry

* Sort pipfile

* Remove flake8 from req, use new rec line-width of 110, black format

* Remove flake8 from req, use new rec line-width of 110, black format

* Add dnspython (pymongo[srv]) as req

* Updates channel.move, bot.close, emoji changes

* Keep more log files

* Bump version

* Black format

* Updated sponsors

* Improved dockerfile

* Add restart and environment for bot

* Update sponsors

* Update modmail.py

fix typo { modmail-dev#3067 } { https://usagi.xn--6frz82g/6DEshJ }

* Formatting and final updates to deps

* formatting

* Fix SSL Error

* Changelog

* bump v

* Fix failing Docker build

* Fix UnicodeEncodeError on Windows. (modmail-dev#3043)

* Fix UnionEncodeError on Windows when logging unicode emojis or special characters.

* Formatting...

* Plugins: add Python Discord's

- **Case insensitive snippets**: Allow snippets to be ran even if with the wrong case. For example, `?Dm-RePort` will be recognized as `?dm-report`.
- **Close message:** Add a `?closemessage` command that will close the thread after 15 minutes with a default message.
- **MDLink**: Generate a ready to paste link to the thread logs.
- **Reply cooldown**: Forbid you from sending the same message twice in ten seconds.
- **Tagging**: Add a `?tag` command capable of adding a `$message|` header to the channel name.

* Let snippets be invoked case-insensitively.

* Update changelogs

* Update changelog

* Improved way to do case insensitive snippets

* Update changelog and merge issues

* Formatting

* Fix contact with category and silent, modmail-dev#3076

* Resolve close_on_leave_reason not properly working

* Invalid arguments are now properly catched and a proper error message is sent (BadUnionArg)

* Removeuser (resolve modmail-dev#3065), silent adding/removing (modmail-dev#3054)

* Formatting

* add multiple users to a thread (resolve modmail-dev#3066), new group config options

* Formatting

* Fix formatter, allow add by roles (resolve modmail-dev#3053)

* Remove tagging and case insensitive plugins

* Changelog

* Use highest hoisted role as default tag, resolves modmail-dev#3014

* Reload thread cache only when it's the first on_ready trigger. Resolves modmail-dev#3037

* Resolve linked messages issues, improve group functionality (bugfixes), resolves modmail-dev#3041

* Persistent notes are now properly deleted,resolve  modmail-dev#3013

* Fix changelog formatting

* Fix changelog formatting

* Fix changelog formatting

* New thread related config, resolves modmail-dev#3072

* Resolve issues with deleting messages

* use_timestamp_channel_name config

* formatting

* add documentation and fix timestamp related bugs

* Initial commit

* Bug fixes and debug removal

* Remove debug

* Remove additional debug

* Update bot.py

* Edit error message

* move format_channel_name to Bot, resolve modmail-dev#2982

* Formatting

* bump ver

* Bug fixes

* Redo alias conversion

* Remove redundant category checks

* ?contact accepts multiple users, or role modmail-dev#3082

* Changelog and fix bot perm level

* Remove extra loop.close

* Push version to 3.10

* Quick bugfix on config help and debug hastebin

* Fix bug where snippet add did not check command name

* v3.10.1 - fix edit cmd

* Fix contact

* bump ver

* oops

* Add phish checker plugin

* Added sponsor

* Update SPONSORS.json

* Update bandit baseline:

* 3.10.3 contact fix

Co-authored-by: Jia Rong Yee <28086837+fourjr@users.noreply.github.com>
Co-authored-by: Jerrie-Aries <70805800+Jerrie-Aries@users.noreply.github.com>
Co-authored-by: Ayam Dobhal <dobhalayam@gmail.com>
Co-authored-by: lorenzo132 <50767078+lorenzo132@users.noreply.github.com>
Co-authored-by: scragly <29337040+scragly@users.noreply.github.com>
Co-authored-by: Taku <45324516+Taaku18@users.noreply.github.com>
Co-authored-by: ❥sora <60399731+6days9weeks@users.noreply.github.com>
Co-authored-by: Ralph <blackbirdralph@aol.com>
Co-authored-by: codeinteger6 <44692189+codeinteger6@users.noreply.github.com>
Co-authored-by: redstonedesigner <redstonedesigner1@gmail.com>
Co-authored-by: Stephen <48072084+StephenDaDev@users.noreply.github.com>
Co-authored-by: Cyrus Yip <cyruscmyip1@gmail.com>
Co-authored-by: Cyrus <54488650+RealCyGuy@users.noreply.github.com>
Co-authored-by: Matt Nikkel <matt.nikkel@hey.com>
Co-authored-by: Matteo Bertucci <matteobertucci2004@gmail.com>
Co-authored-by: Qwerty-133 <74311372+Qwerty-133@users.noreply.github.com>
Co-authored-by: popeeyy <29686338+popeeyy@users.noreply.github.com>
Co-authored-by: kato <78689486+TheDiscordHistorian@users.noreply.github.com>
  • Loading branch information
19 people committed Mar 12, 2022
1 parent c778bd5 commit 3a9e23f
Show file tree
Hide file tree
Showing 39 changed files with 3,152 additions and 1,856 deletions.
67 changes: 41 additions & 26 deletions .bandit_baseline.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"errors": [],
"generated_at": "2020-11-12T15:17:38Z",
"generated_at": "2021-11-20T17:06:28Z",
"metrics": {
"./bot.py": {
"CONFIDENCE.HIGH": 1.0,
Expand All @@ -11,7 +11,7 @@
"SEVERITY.LOW": 1.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 1264,
"loc": 1406,
"nosec": 0
},
"./cogs/modmail.py": {
Expand All @@ -23,7 +23,7 @@
"SEVERITY.LOW": 0.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 1280,
"loc": 1678,
"nosec": 0
},
"./cogs/plugins.py": {
Expand All @@ -35,7 +35,7 @@
"SEVERITY.LOW": 1.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 572,
"loc": 597,
"nosec": 0
},
"./cogs/utility.py": {
Expand All @@ -47,7 +47,7 @@
"SEVERITY.LOW": 1.0,
"SEVERITY.MEDIUM": 1.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 1710,
"loc": 1768,
"nosec": 0
},
"./core/_color_data.py": {
Expand All @@ -63,15 +63,15 @@
"nosec": 0
},
"./core/changelog.py": {
"CONFIDENCE.HIGH": 0.0,
"CONFIDENCE.HIGH": 1.0,
"CONFIDENCE.LOW": 0.0,
"CONFIDENCE.MEDIUM": 0.0,
"CONFIDENCE.UNDEFINED": 0.0,
"SEVERITY.HIGH": 0.0,
"SEVERITY.LOW": 0.0,
"SEVERITY.LOW": 1.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 145,
"loc": 159,
"nosec": 0
},
"./core/checks.py": {
Expand All @@ -83,7 +83,7 @@
"SEVERITY.LOW": 0.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 89,
"loc": 105,
"nosec": 0
},
"./core/clients.py": {
Expand All @@ -95,7 +95,7 @@
"SEVERITY.LOW": 1.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 585,
"loc": 598,
"nosec": 0
},
"./core/config.py": {
Expand All @@ -107,7 +107,7 @@
"SEVERITY.LOW": 0.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 327,
"loc": 375,
"nosec": 0
},
"./core/decorators.py": {
Expand All @@ -131,7 +131,7 @@
"SEVERITY.LOW": 0.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 199,
"loc": 204,
"nosec": 0
},
"./core/paginator.py": {
Expand All @@ -155,7 +155,7 @@
"SEVERITY.LOW": 0.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 993,
"loc": 1097,
"nosec": 0
},
"./core/time.py": {
Expand All @@ -167,7 +167,7 @@
"SEVERITY.LOW": 0.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 158,
"loc": 156,
"nosec": 0
},
"./core/utils.py": {
Expand All @@ -179,32 +179,32 @@
"SEVERITY.LOW": 0.0,
"SEVERITY.MEDIUM": 0.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 283,
"loc": 351,
"nosec": 0
},
"_totals": {
"CONFIDENCE.HIGH": 4.0,
"CONFIDENCE.HIGH": 5.0,
"CONFIDENCE.LOW": 0.0,
"CONFIDENCE.MEDIUM": 1.0,
"CONFIDENCE.UNDEFINED": 0.0,
"SEVERITY.HIGH": 0.0,
"SEVERITY.LOW": 4.0,
"SEVERITY.LOW": 5.0,
"SEVERITY.MEDIUM": 1.0,
"SEVERITY.UNDEFINED": 0.0,
"loc": 8989,
"loc": 9878,
"nosec": 0
}
},
"results": [
{
"code": "11 from datetime import datetime\n12 from subprocess import PIPE\n13 from types import SimpleNamespace\n",
"code": "13 from datetime import datetime\n14 from subprocess import PIPE\n15 from types import SimpleNamespace\n",
"filename": "./bot.py",
"issue_confidence": "HIGH",
"issue_severity": "LOW",
"issue_text": "Consider possible security implications associated with PIPE module.",
"line_number": 12,
"line_number": 14,
"line_range": [
12
14
],
"more_info": "https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess",
"test_id": "B404",
Expand Down Expand Up @@ -240,27 +240,42 @@
"test_name": "blacklist"
},
{
"code": "1985 try:\n1986 exec(to_compile, env) # pylint: disable=exec-used\n1987 except Exception as exc:\n",
"code": "2061 try:\n2062 exec(to_compile, env) # pylint: disable=exec-used\n2063 except Exception as exc:\n",
"filename": "./cogs/utility.py",
"issue_confidence": "HIGH",
"issue_severity": "MEDIUM",
"issue_text": "Use of exec detected.",
"line_number": 1986,
"line_number": 2062,
"line_range": [
1986
2062
],
"more_info": "https://bandit.readthedocs.io/en/latest/plugins/b102_exec_used.html",
"test_id": "B102",
"test_name": "exec_used"
},
{
"code": "68 \n69 def __init__(self, bot, access_token: str = \"\", username: str = \"\", **kwargs):\n70 self.bot = bot\n71 self.session = bot.session\n72 self.headers: dict = None\n73 self.access_token = access_token\n74 self.username = username\n75 self.avatar_url: str = kwargs.pop(\"avatar_url\", \"\")\n76 self.url: str = kwargs.pop(\"url\", \"\")\n77 if self.access_token:\n78 self.headers = {\"Authorization\": \"token \" + str(access_token)}\n79 \n80 async def request(\n",
"code": "2 import re\n3 from subprocess import PIPE\n4 from typing import List\n",
"filename": "./core/changelog.py",
"issue_confidence": "HIGH",
"issue_severity": "LOW",
"issue_text": "Consider possible security implications associated with PIPE module.",
"line_number": 3,
"line_range": [
3
],
"more_info": "https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess",
"test_id": "B404",
"test_name": "blacklist"
},
{
"code": "67 \n68 def __init__(self, bot, access_token: str = \"\", username: str = \"\", **kwargs):\n69 self.bot = bot\n70 self.session = bot.session\n71 self.headers: Optional[dict] = None\n72 self.access_token = access_token\n73 self.username = username\n74 self.avatar_url: str = kwargs.pop(\"avatar_url\", \"\")\n75 self.url: str = kwargs.pop(\"url\", \"\")\n76 if self.access_token:\n77 self.headers = {\"Authorization\": \"token \" + str(access_token)}\n78 \n79 @property\n80 def BRANCH(self):\n",
"filename": "./core/clients.py",
"issue_confidence": "MEDIUM",
"issue_severity": "LOW",
"issue_text": "Possible hardcoded password: ''",
"line_number": 69,
"line_number": 68,
"line_range": [
68,
69,
70,
71,
Expand Down
13 changes: 4 additions & 9 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,23 +133,18 @@ node_modules/
config.json
plugins/
!plugins/registry.json
!plugins/@local/
temp/
test.py

# Other stuff
.env.example
.gitignore
.lint.py
.pylintrc
.travis.yml
.github/
app.json
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
requirements.min.txt
Procfile
pyproject.toml
README.md
runtime.txt
SPONSORS.json
stack.yml
Pipfile
Pipfile.lock
38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

55 changes: 55 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Bug Report
description: File a bug report
title: "[BUG]: your bug report title"
labels: "maybe: bug"
body:
- type: input
id: bot-info-version
attributes:
label: Bot Version
description: Check it with `@modmail about`
placeholder: eg. v3.9.4
validations:
required: true
- type: dropdown
id: bot-info-hosting
attributes:
label: How are you hosting Modmail?
description: You can check it with `@modmail about` if you are unsure
options:
- Heroku
- Systemd
- PM2
- Patreon
- Other
validations:
required: true
- type: input
id: logs
attributes:
label: Error Logs
placeholder: https://hastebin.cc/placeholder
description:
"If your Modmail bot is online, type `@modmail debug hastebin` and include the link here.
If your Modmail bot is not online or the previous command did not generate a link, do the following:
1. Select your *bot* application at https://dashboard.heroku.com
2. [Restart your bot](https://i.imgur.com/3FcrlKz.png)
3. Reproduce the error to populate the error logs
4. [Copy and paste the logs](https://i.imgur.com/TTrhitm.png)"
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots
description: "[optional] You may add screenshots to further explain your problem."
- type: textarea
id: additional-info
attributes:
label: Additional Information
description: "[optional] You may provide additional context for us to better understand how this issue occured."
23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/command-request.md

This file was deleted.

5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Discord Server
url: https://discord.gg/etJNHCQ
about: Please ask hosting-related questions here before creating an issue.
23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

Loading

0 comments on commit 3a9e23f

Please sign in to comment.