Skip to content

Commit ecee83d

Browse files
authored
Merge branch 'development' into patch-1
2 parents e806842 + 5ddb4e0 commit ecee83d

18 files changed

+228
-194
lines changed

.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
TOKEN=MyBotToken
22
LOG_URL=https://logviewername.herokuapp.com/
33
GUILD_ID=1234567890
4-
MODMAIL_GUILD_ID=1234567890
54
OWNERS=Owner1ID,Owner2ID,Owner3ID
65
CONNECTION_URI=mongodb+srv://mongodburi

.github/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ Pull requests are the best way to propose changes to the codebase. We actively w
3030
## Any contributions you make will be under the GNU Affero General Public License v3.0
3131
In short, when you submit code changes, your submissions are understood to be under the same [GNU Affero General Public License v3.0](https://www.gnu.org/licenses/agpl-3.0.en.html) that covers the project. Feel free to contact the maintainers if that's a concern.
3232

33-
## Report bugs using [Github Issues](https://github.com/kyb3r/modmail/issues)
34-
We use GitHub issues to track public bugs. Report a bug by [opening a new Issue](https://github.com/kyb3r/modmail/issues/new); it's that easy!
33+
## Report bugs using [Github Issues](https://github.com/modmail-dev/modmail/issues)
34+
We use GitHub issues to track public bugs. Report a bug by [opening a new Issue](https://github.com/modmail-dev/modmail/issues/new); it's that easy!
3535

3636
## Find pre-existing issues to tackle
37-
Check out our [unstaged issue tracker](https://github.com/kyb3r/modmail/issues?q=is%3Aissue+is%3Aopen+-label%3Astaged) and start helping out!
37+
Check out our [unstaged issue tracker](https://github.com/modmail-dev/modmail/issues?q=is%3Aissue+is%3Aopen+-label%3Astaged) and start helping out!
3838

3939
Ways to help out:
4040
- Help out new members

.github/pull.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: "1"
22
rules:
33
- base: master
4-
upstream: kyb3r:master
4+
upstream: modmail-dev:master
55
mergeMethod: hardreset
66
- base: development
7-
upstream: kyb3r:development
7+
upstream: modmail-dev:development
88
mergeMethod: hardreset

.github/workflows/lints.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@ on: [push, pull_request]
44

55
jobs:
66
code-style:
7-
runs-on: ${{ matrix.os }}
7+
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
os: [ubuntu-latest, windows-latest, macOS-latest]
11-
python-version: ['3.8', '3.9', '3.10']
10+
python-version: ['3.9', '3.10']
1211

13-
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
12+
name: Python ${{ matrix.python-version }} on ubuntu-latest
1413

1514
steps:
1615
- uses: actions/checkout@v3
1716
- name: Set up Python
18-
uses: actions/setup-python@v3
17+
uses: actions/setup-python@v4
1918
with:
2019
python-version: ${{ matrix.python-version }}
2120
architecture: x64

CHANGELOG.md

Lines changed: 122 additions & 114 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111

1212
<br>
1313

14-
<a href="https://heroku.com/deploy?template=https://github.com/kyb3r/modmail">
14+
<a href="https://heroku.com/deploy?template=https://github.com/modmail-dev/modmail">
1515
<img src="https://img.shields.io/badge/deploy_to-heroku-997FBC.svg?style=for-the-badge&logo=Heroku">
1616
</a>
1717

18-
<a href="https://github.com/kyb3r/modmail/">
18+
<a href="https://github.com/modmail-dev/modmail/">
1919
<img src="https://api.modmail.dev/badges/instances.svg" alt="Bot instances">
2020
</a>
2121

22-
<a href="https://discord.gg/j5e9p8w">
23-
<img src="https://img.shields.io/discord/515071617815019520.svg?label=Discord&logo=Discord&colorB=7289da&style=for-the-badge" alt="Support">
22+
<a href="https://discord.gg/cnUpwrnpYb">
23+
<img src="https://img.shields.io/discord/1079074933008781362.svg?label=Discord&logo=Discord&colorB=7289da&style=for-the-badge" alt="Support">
2424
</a>
2525

2626
<a href="https://patreon.com/kyber">
@@ -35,7 +35,7 @@
3535
<img src="https://img.shields.io/badge/Code%20Style-Black-black?style=for-the-badge">
3636
</a>
3737

38-
<a href="https://github.com/kyb3r/modmail/blob/master/LICENSE">
38+
<a href="https://github.com/modmail-dev/modmail/blob/master/LICENSE">
3939
<img src="https://img.shields.io/badge/license-agpl-e74c3c.svg?style=for-the-badge" alt="MIT License">
4040
</a>
4141

@@ -96,23 +96,23 @@ There are a few options for hosting your very own dedicated Modmail bot.
9696

9797
### Patreon Hosting
9898

99-
If you don't want the trouble of renting and configuring your server to host Modmail, we got a solution for you! We offer hosting and maintenance of your own, private Modmail bot (including a Logviewer) through [**Patreon**](https://patreon.com/kyber). Join our [Modmail Discord Server](https://discord.gg/etJNHCQ) for more info!
99+
If you don't want the trouble of renting and configuring your server to host Modmail, we got a solution for you! We offer hosting and maintenance of your own, private Modmail bot (including a Logviewer) through [**Patreon**](https://patreon.com/kyber). Join our [Modmail Discord Server](https://discord.gg/cnUpwrnpYb) for more info!
100100

101101
### Local hosting (General Guide)
102102

103-
Modmail can be hosted on any modern hardware, including your PC. For stability and reliability, we suggest purchasing a cloud server (VPS) for under $10/mo. If you need recommendations on choosing a VPS, join our [Discord server](https://discord.gg/j5e9p8w), and we'll send you a list of non-affiliated hosting providers. Alternatively, we can host Modmail for you when you're subscribed to our [Patreon](https://patreon.com/kyber).
103+
Modmail can be hosted on any modern hardware, including your PC. For stability and reliability, we suggest purchasing a cloud server (VPS) for under $10/mo. If you need recommendations on choosing a VPS, join our [Discord server](https://discord.gg/cnUpwrnpYb), and we'll send you a list of non-affiliated hosting providers. Alternatively, we can host Modmail for you when you're subscribed to our [Patreon](https://patreon.com/kyber).
104104

105105
This guide assumes you've downloaded [`Python 3.10`](https://www.python.org/downloads/release/python-376/) and added python and pip to PATH.
106106

107107
1. Clone this repo
108108
```console
109-
$ git clone https://github.com/kyb3r/modmail
109+
$ git clone https://github.com/modmail-dev/modmail
110110
$ cd modmail
111111
```
112-
2. Create a Discord bot account, grant the necessary intents, and invite the bot ([guide](https://github.com/kyb3r/modmail/wiki/Installation#2-discord-bot-account))
113-
3. Create a free MongoDB database ([guide](https://github.com/kyb3r/modmail/wiki/Installation-(cont.)#3-create-a-database), follow it carefully!)
112+
2. Create a Discord bot account, grant the necessary intents, and invite the bot ([guide](https://github.com/modmail-dev/modmail/wiki/Installation#2-discord-bot-account))
113+
3. Create a free MongoDB database ([guide](https://github.com/modmail-dev/modmail/wiki/Installation-(cont.)#3-create-a-database), follow it carefully!)
114114
4. Rename the file `.env.example` to `.env` and fill it with appropriate values
115-
- If you can't find `.env.example` because it's hidden, create a new text file named `.env`, then copy the contents of [this file](https://raw.githubusercontent.com/kyb3r/modmail/master/.env.example) and replace the placeholders with their values
115+
- If you can't find `.env.example` because it's hidden, create a new text file named `.env`, then copy the contents of [this file](https://raw.githubusercontent.com/modmail-dev/modmail/master/.env.example) and replace the placeholders with their values
116116
- If you're on Windows and cannot save the file as `.env`, save it as `.env.` instead (this only applies to Windows!)
117117
- If you do not have a Logviewer yet, leave the `LOG_URL` field as-is
118118
5. Update pip, install pipenv, and install dependencies using pipenv
@@ -125,16 +125,16 @@ This guide assumes you've downloaded [`Python 3.10`](https://www.python.org/down
125125
```console
126126
$ pipenv run bot
127127
```
128-
7. Set up the Logviewer, see the [Logviewer installation guide](https://github.com/kyb3r/logviewer)
128+
7. Set up the Logviewer, see the [Logviewer installation guide](https://github.com/modmail-dev/logviewer)
129129

130130
### Local Hosting (Docker)
131131

132132
We provide support for Docker to simplify the deployment of Modmail and Logviewer.
133133
We assume you already have Docker and Docker Compose Plugin installed, if not, see [here](https://docs.docker.com/get-docker/).
134134

135-
1. Create a Discord bot account, grant the necessary intents, and invite the bot ([guide](https://github.com/kyb3r/modmail/wiki/Installation#2-discord-bot-account))
136-
2. Create a file named `.env`, then copy the contents of [this file](https://raw.githubusercontent.com/kyb3r/modmail/master/.env.example) and replace the placeholders with their values
137-
3. Create a file named `docker-compose.yml`, then copy the contents of [this file](https://raw.githubusercontent.com/kyb3r/modmail/master/docker-compose.yml), do not change anything!
135+
1. Create a Discord bot account, grant the necessary intents, and invite the bot ([guide](https://github.com/modmail-dev/modmail/wiki/Installation#2-discord-bot-account))
136+
2. Create a file named `.env`, then copy the contents of [this file](https://raw.githubusercontent.com/modmail-dev/modmail/master/.env.example) and replace the placeholders with their values
137+
3. Create a file named `docker-compose.yml`, then copy the contents of [this file](https://raw.githubusercontent.com/modmail-dev/modmail/master/docker-compose.yml), do not change anything!
138138
4. Start the bot
139139
```console
140140
$ docker compose up -d
@@ -147,22 +147,22 @@ Our Docker images are hosted on [GitHub Container Registry](ghcr.io), you can bu
147147
$ docker build --tag=modmail:master .
148148
```
149149

150-
Then simply remove `ghcr.io/kyb3r/` from the `docker-compose.yml` file.
150+
Then simply remove `ghcr.io/modmail-dev/` from the `docker-compose.yml` file.
151151

152152
### Local Hosting (OS-Specific)
153153

154-
This guide is a WIP. Join our [Discord server](https://discord.gg/j5e9p8w) for more info.
154+
This guide is a WIP. Join our [Discord server](https://discord.gg/cnUpwrnpYb) for more info.
155155

156156
### Platform as a Service (PaaS)
157157

158158
You can host this bot on Heroku (no longer free).
159159

160160
Installation via Heroku is possible with your web browser alone.
161-
The [**installation guide**](https://github.com/kyb3r/modmail/wiki/Installation) (which includes a video tutorial!) will guide you through the entire installation process. If you run into any problems, join our [Modmail Discord Server](https://discord.gg/etJNHCQ) for help and support.
161+
The [**installation guide**](https://github.com/modmail-dev/modmail/wiki/Installation) (which includes a video tutorial!) will guide you through the entire installation process. If you run into any problems, join our [Modmail Discord Server](https://discord.gg/cnUpwrnpYb) for help and support.
162162

163163
When using Heroku, you can configure automatic updates:
164164
- Login to [GitHub](https://github.com/) and verify your account.
165-
- [Fork the repo](https://github.com/kyb3r/modmail/fork).
165+
- [Fork the repo](https://github.com/modmail-dev/modmail/fork).
166166
- Install the [Pull app](https://github.com/apps/pull) for your fork.
167167
- Then go to the Deploy tab in your [Heroku account](https://dashboard.heroku.com/apps) of your bot app, select GitHub and connect your fork (usually by typing "Modmail").
168168
- Turn on auto-deploy for the `master` branch.
@@ -213,20 +213,20 @@ Become a sponsor on [Patreon](https://patreon.com/kyber).
213213
Modmail supports the use of third-party plugins to extend or add functionalities to the bot.
214214
Plugins allow niche features as well as anything else outside of the scope of the core functionality of Modmail.
215215

216-
You can find a list of third-party plugins using the `?plugins registry` command or visit the [Unofficial List of Plugins](https://github.com/kyb3r/modmail/wiki/Unofficial-List-of-Plugins) for a list of plugins contributed by the community.
216+
You can find a list of third-party plugins using the `?plugins registry` command or visit the [Unofficial List of Plugins](https://github.com/modmail-dev/modmail/wiki/Unofficial-List-of-Plugins) for a list of plugins contributed by the community.
217217

218-
To develop your own, check out the [plugins documentation](https://github.com/kyb3r/modmail/wiki/Plugins).
218+
To develop your own, check out the [plugins documentation](https://github.com/modmail-dev/modmail/wiki/Plugins).
219219

220-
Plugins requests and support are available in our [Modmail Support Server](https://discord.gg/j5e9p8w).
220+
Plugins requests and support are available in our [Modmail Support Server](https://discord.gg/cnUpwrnpYb).
221221

222222
## Contributing
223223

224-
Contributions to Modmail are always welcome, whether it be improvements to the documentation or new functionality, please feel free to make the change. Check out our [contributing guidelines](https://github.com/kyb3r/modmail/blob/master/.github/CONTRIBUTING.md) before you get started.
224+
Contributions to Modmail are always welcome, whether it be improvements to the documentation or new functionality, please feel free to make the change. Check out our [contributing guidelines](https://github.com/modmail-dev/modmail/blob/master/.github/CONTRIBUTING.md) before you get started.
225225

226226
If you like this project and would like to show your appreciation, support us on **[Patreon](https://www.patreon.com/kyber)**!
227227

228228
## Beta Testing
229229

230-
Our [development](https://github.com/kyb3r/modmail/tree/development) branch is where most of our features are tested before public release. Be warned that there could be bugs in various commands so keep it away from any large servers you manage.
230+
Our [development](https://github.com/modmail-dev/modmail/tree/development) branch is where most of our features are tested before public release. Be warned that there could be bugs in various commands so keep it away from any large servers you manage.
231231

232232
If you wish to test the new features and play around with them, feel free to join our [Public Test Server](https://discord.gg/v5hTjKC). Bugs can be raised within that server or in our Github issues (state that you are using the development branch though).

app.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Modmail",
33
"description": "An easy to install Modmail bot for Discord - DM to contact mods!",
4-
"repository": "https://github.com/kyb3r/modmail",
4+
"repository": "https://github.com/modmail-dev/modmail",
55
"env": {
66
"TOKEN": {
77
"description": "Your discord bot's token.",
@@ -11,10 +11,6 @@
1111
"description": "The id for the server you are hosting this bot for.",
1212
"required": true
1313
},
14-
"MODMAIL_GUILD_ID": {
15-
"description": "The ID of the discord server where the threads channels should be created (receiving server). Default to GUILD_ID.",
16-
"required": false
17-
},
1814
"OWNERS": {
1915
"description": "Comma separated user IDs of people that are allowed to use owner only commands. (eval).",
2016
"required": true
@@ -34,6 +30,10 @@
3430
"GITHUB_TOKEN": {
3531
"description": "A github personal access token with the repo scope.",
3632
"required": false
33+
},
34+
"REGISTRY_PLUGINS_ONLY": {
35+
"description": "If set to true, only plugins that are in the registry can be loaded.",
36+
"required": false
3737
}
3838
}
39-
}
39+
}

bot.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,16 @@ def __init__(self):
9090
self.plugin_db = PluginDatabaseClient(self) # Deprecated
9191
self.startup()
9292

93-
def get_guild_icon(self, guild: typing.Optional[discord.Guild]) -> str:
93+
def get_guild_icon(
94+
self, guild: typing.Optional[discord.Guild], *, size: typing.Optional[int] = None
95+
) -> str:
9496
if guild is None:
9597
guild = self.guild
9698
if guild.icon is None:
9799
return "https://cdn.discordapp.com/embed/avatars/0.png"
98-
return guild.icon.url
100+
if size is None:
101+
return guild.icon.url
102+
return guild.icon.with_size(size).url
99103

100104
def _resolve_snippet(self, name: str) -> typing.Optional[str]:
101105
"""
@@ -888,7 +892,7 @@ async def process_dm_modmail(self, message: discord.Message) -> None:
888892
return
889893
sent_emoji, blocked_emoji = await self.retrieve_emoji()
890894

891-
if message.type != discord.MessageType.default:
895+
if message.type not in [discord.MessageType.default, discord.MessageType.reply]:
892896
return
893897

894898
thread = await self.threads.find(recipient=message.author)
@@ -912,7 +916,7 @@ async def process_dm_modmail(self, message: discord.Message) -> None:
912916
)
913917
embed.set_footer(
914918
text=self.config["disabled_new_thread_footer"],
915-
icon_url=self.get_guild_icon(guild=message.guild),
919+
icon_url=self.get_guild_icon(guild=message.guild, size=128),
916920
)
917921
logger.info("A new thread was blocked from %s due to disabled Modmail.", message.author)
918922
await self.add_reaction(message, blocked_emoji)
@@ -928,7 +932,7 @@ async def process_dm_modmail(self, message: discord.Message) -> None:
928932
)
929933
embed.set_footer(
930934
text=self.config["disabled_current_thread_footer"],
931-
icon_url=self.get_guild_icon(guild=message.guild),
935+
icon_url=self.get_guild_icon(guild=message.guild, size=128),
932936
)
933937
logger.info("A message was blocked from %s due to disabled Modmail.", message.author)
934938
await self.add_reaction(message, blocked_emoji)
@@ -1335,7 +1339,7 @@ async def handle_react_to_contact(self, payload):
13351339
)
13361340
embed.set_footer(
13371341
text=self.config["disabled_new_thread_footer"],
1338-
icon_url=self.get_guild_icon(guild=channel.guild),
1342+
icon_url=self.get_guild_icon(guild=channel.guild, size=128),
13391343
)
13401344
logger.info(
13411345
"A new thread using react to contact was blocked from %s due to disabled Modmail.",

cogs/modmail.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async def setup(self, ctx):
9494
embed.add_field(
9595
name="Thanks for using our bot!",
9696
value="If you like what you see, consider giving the "
97-
"[repo a star](https://github.com/kyb3r/modmail) :star: and if you are "
97+
"[repo a star](https://github.com/modmail-dev/modmail) :star: and if you are "
9898
"feeling extra generous, buy us coffee on [Patreon](https://patreon.com/kyber) :heart:!",
9999
)
100100

@@ -160,15 +160,15 @@ async def snippet(self, ctx, *, name: str.lower = None):
160160
color=self.bot.error_color, description="You dont have any snippets at the moment."
161161
)
162162
embed.set_footer(text=f'Check "{self.bot.prefix}help snippet add" to add a snippet.')
163-
embed.set_author(name="Snippets", icon_url=self.bot.get_guild_icon(guild=ctx.guild))
163+
embed.set_author(name="Snippets", icon_url=self.bot.get_guild_icon(guild=ctx.guild, size=128))
164164
return await ctx.send(embed=embed)
165165

166166
embeds = []
167167

168168
for i, names in enumerate(zip_longest(*(iter(sorted(self.bot.snippets)),) * 15)):
169169
description = format_description(i, names)
170170
embed = discord.Embed(color=self.bot.main_color, description=description)
171-
embed.set_author(name="Snippets", icon_url=self.bot.get_guild_icon(guild=ctx.guild))
171+
embed.set_author(name="Snippets", icon_url=self.bot.get_guild_icon(guild=ctx.guild, size=128))
172172
embeds.append(embed)
173173

174174
session = EmbedPaginatorSession(ctx, *embeds)
@@ -1031,7 +1031,7 @@ async def anonadduser(self, ctx, *users_arg: Union[discord.Member, discord.Role,
10311031
name = tag
10321032
avatar_url = self.bot.config["anon_avatar_url"]
10331033
if avatar_url is None:
1034-
avatar_url = self.bot.get_guild_icon(guild=ctx.guild)
1034+
avatar_url = self.bot.get_guild_icon(guild=ctx.guild, size=128)
10351035
em.set_footer(text=name, icon_url=avatar_url)
10361036

10371037
for u in users:
@@ -1120,7 +1120,7 @@ async def anonremoveuser(self, ctx, *users_arg: Union[discord.Member, discord.Ro
11201120
name = tag
11211121
avatar_url = self.bot.config["anon_avatar_url"]
11221122
if avatar_url is None:
1123-
avatar_url = self.bot.get_guild_icon(guild=ctx.guild)
1123+
avatar_url = self.bot.get_guild_icon(guild=ctx.guild, size=128)
11241124
em.set_footer(text=name, icon_url=avatar_url)
11251125

11261126
for u in users:

0 commit comments

Comments
 (0)