Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Taaku18 authored Mar 21, 2023
2 parents 726fb0c + b21037c commit 02250e8
Show file tree
Hide file tree
Showing 15 changed files with 202 additions and 172 deletions.
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ Pull requests are the best way to propose changes to the codebase. We actively w
## Any contributions you make will be under the GNU Affero General Public License v3.0
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.

## Report bugs using [Github Issues](https://github.com/kyb3r/modmail/issues)
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!
## Report bugs using [Github Issues](https://github.com/modmail-dev/modmail/issues)
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!

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

Ways to help out:
- Help out new members
Expand Down
4 changes: 2 additions & 2 deletions .github/pull.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "1"
rules:
- base: master
upstream: kyb3r:master
upstream: modmail-dev:master
mergeMethod: hardreset
- base: development
upstream: kyb3r:development
upstream: modmail-dev:development
mergeMethod: hardreset
9 changes: 4 additions & 5 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@ on: [push, pull_request]

jobs:
code-style:
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.9', '3.10']

name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
name: Python ${{ matrix.python-version }} on ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
Expand Down
236 changes: 122 additions & 114 deletions CHANGELOG.md

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@

<br>

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

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

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

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

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

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

### Patreon Hosting

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!
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!

### Local hosting (General Guide)

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).
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).

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

1. Clone this repo
```console
$ git clone https://github.com/kyb3r/modmail
$ git clone https://github.com/modmail-dev/modmail
$ cd modmail
```
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))
3. Create a free MongoDB database ([guide](https://github.com/kyb3r/modmail/wiki/Installation-(cont.)#3-create-a-database), follow it carefully!)
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))
3. Create a free MongoDB database ([guide](https://github.com/modmail-dev/modmail/wiki/Installation-(cont.)#3-create-a-database), follow it carefully!)
4. Rename the file `.env.example` to `.env` and fill it with appropriate values
- 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
- 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
- If you're on Windows and cannot save the file as `.env`, save it as `.env.` instead (this only applies to Windows!)
- If you do not have a Logviewer yet, leave the `LOG_URL` field as-is
5. Update pip, install pipenv, and install dependencies using pipenv
Expand All @@ -125,16 +125,16 @@ This guide assumes you've downloaded [`Python 3.10`](https://www.python.org/down
```console
$ pipenv run bot
```
7. Set up the Logviewer, see the [Logviewer installation guide](https://github.com/kyb3r/logviewer)
7. Set up the Logviewer, see the [Logviewer installation guide](https://github.com/modmail-dev/logviewer)

### Local Hosting (Docker)

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

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))
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
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!
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))
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
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!
4. Start the bot
```console
$ docker compose up -d
Expand All @@ -147,22 +147,22 @@ Our Docker images are hosted on [GitHub Container Registry](ghcr.io), you can bu
$ docker build --tag=modmail:master .
```

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

### Local Hosting (OS-Specific)

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

### Platform as a Service (PaaS)

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

Installation via Heroku is possible with your web browser alone.
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.
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.

When using Heroku, you can configure automatic updates:
- Login to [GitHub](https://github.com/) and verify your account.
- [Fork the repo](https://github.com/kyb3r/modmail/fork).
- [Fork the repo](https://github.com/modmail-dev/modmail/fork).
- Install the [Pull app](https://github.com/apps/pull) for your fork.
- 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").
- Turn on auto-deploy for the `master` branch.
Expand Down Expand Up @@ -213,20 +213,20 @@ Become a sponsor on [Patreon](https://patreon.com/kyber).
Modmail supports the use of third-party plugins to extend or add functionalities to the bot.
Plugins allow niche features as well as anything else outside of the scope of the core functionality of Modmail.

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.
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.

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

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

## Contributing

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.
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.

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

## Beta Testing

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.
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.

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).
6 changes: 5 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Modmail",
"description": "An easy to install Modmail bot for Discord - DM to contact mods!",
"repository": "https://github.com/kyb3r/modmail",
"repository": "https://github.com/modmail-dev/modmail",
"env": {
"TOKEN": {
"description": "Your discord bot's token.",
Expand Down Expand Up @@ -34,6 +34,10 @@
"GITHUB_TOKEN": {
"description": "A github personal access token with the repo scope.",
"required": false
},
"REGISTRY_PLUGINS_ONLY": {
"description": "If set to true, only plugins that are in the registry can be loaded.",
"required": false
}
}
}
2 changes: 1 addition & 1 deletion cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async def setup(self, ctx):
embed.add_field(
name="Thanks for using our bot!",
value="If you like what you see, consider giving the "
"[repo a star](https://github.com/kyb3r/modmail) :star: and if you are "
"[repo a star](https://github.com/modmail-dev/modmail) :star: and if you are "
"feeling extra generous, buy us coffee on [Patreon](https://patreon.com/kyber) :heart:!",
)

Expand Down
12 changes: 10 additions & 2 deletions cogs/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Plugins(commands.Cog):
These addons could have a range of features from moderation to simply
making your life as a moderator easier!
Learn how to create a plugin yourself here:
https://github.com/kyb3r/modmail/wiki/Plugins
https://github.com/modmail-dev/modmail/wiki/Plugins
"""

def __init__(self, bot):
Expand All @@ -131,7 +131,7 @@ async def cog_load(self):
logger.info("Plugins not loaded since ENABLE_PLUGINS=false.")

async def populate_registry(self):
url = "https://raw.githubusercontent.com/kyb3r/modmail/master/plugins/registry.json"
url = "https://raw.githubusercontent.com/modmail-dev/modmail/master/plugins/registry.json"
async with self.bot.session.get(url) as resp:
self.registry = json.loads(await resp.text())

Expand Down Expand Up @@ -302,6 +302,14 @@ async def parse_user_input(self, ctx, plugin_name, check_version=False):
plugin = Plugin(user, repo, plugin_name, branch)

else:
if not self.bot.config.get("registry_plugins_only", False):
embed = discord.Embed(
description="This plugin is not in the registry. "
"To install it, you must set `REGISTRY_PLUGINS_ONLY=false` in your .env file or config settings.",
color=self.bot.error_color,
)
await ctx.send(embed=embed)
return
try:
plugin = Plugin.from_string(plugin_name)
except InvalidPluginError:
Expand Down
6 changes: 3 additions & 3 deletions cogs/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ async def about(self, ctx):

embed.add_field(
name="Want Modmail in Your Server?",
value="Follow the installation guide on [GitHub](https://github.com/kyb3r/modmail/) "
value="Follow the installation guide on [GitHub](https://github.com/modmail-dev/modmail/) "
"and join our [Discord server](https://discord.gg/F34cRU8)!",
inline=False,
)
Expand Down Expand Up @@ -380,7 +380,7 @@ async def sponsors(self, ctx):
"""Shows the sponsors of this project."""

async with self.bot.session.get(
"https://raw.githubusercontent.com/kyb3r/modmail/master/SPONSORS.json"
"https://raw.githubusercontent.com/modmail-dev/modmail/master/SPONSORS.json"
) as resp:
data = loads(await resp.text())

Expand Down Expand Up @@ -1941,7 +1941,7 @@ async def update(self, ctx, *, flag: str = ""):

desc = (
f"The latest version is [`{self.bot.version}`]"
"(https://github.com/kyb3r/modmail/blob/master/bot.py#L1)"
"(https://github.com/modmail-dev/modmail/blob/master/bot.py#L1)"
)

if self.bot.version >= parse_version(latest.version) and flag.lower() != "force":
Expand Down
4 changes: 2 additions & 2 deletions core/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, bot, branch: str, version: str, lines: str):
self.version = version.lstrip("vV")
self.lines = lines.strip()
self.fields = {}
self.changelog_url = f"https://github.com/kyb3r/modmail/blob/{branch}/CHANGELOG.md"
self.changelog_url = f"https://github.com/modmail-dev/modmail/blob/{branch}/CHANGELOG.md"
self.description = ""
self.parse()

Expand Down Expand Up @@ -186,7 +186,7 @@ async def from_url(cls, bot, url: str = "") -> "Changelog":
if branch not in ("master", "development"):
branch = "master"

url = url or f"https://raw.githubusercontent.com/kyb3r/modmail/{branch}/CHANGELOG.md"
url = url or f"https://raw.githubusercontent.com/modmail-dev/modmail/{branch}/CHANGELOG.md"

async with await bot.session.get(url) as resp:
return cls(bot, branch, await resp.text())
4 changes: 2 additions & 2 deletions core/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ class GitHub:
"""

BASE = "https://api.github.com"
REPO = BASE + "/repos/kyb3r/modmail"
REPO = BASE + "/repos/modmail-dev/modmail"
MERGE_URL = BASE + "/repos/{username}/modmail/merges"
FORK_URL = REPO + "/forks"
STAR_URL = BASE + "/user/starred/kyb3r/modmail"
STAR_URL = BASE + "/user/starred/modmail-dev/modmail"

def __init__(self, bot, access_token: str = "", username: str = "", **kwargs):
self.bot = bot
Expand Down
2 changes: 2 additions & 0 deletions core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class ConfigManager:
"connection_uri": None, # replace mongo uri in the future
"owners": None,
"enable_presence_intent": False,
"registry_plugins_only": False,
# bot
"token": None,
"enable_plugins": True,
Expand Down Expand Up @@ -223,6 +224,7 @@ class ConfigManager:
"thread_show_join_age",
"use_hoisted_top_role",
"enable_presence_intent",
"registry_plugins_only",
}

enums = {
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3.7"
services:
bot:
image: ghcr.io/kyb3r/modmail:master
image: ghcr.io/modmail-dev/modmail:master
restart: always
env_file:
- .env
Expand All @@ -10,7 +10,7 @@ services:
depends_on:
- mongo
logviewer:
image: ghcr.io/kyb3r/logviewer:master
image: ghcr.io/modmail-dev/logviewer:master
restart: always
depends_on:
- mongo
Expand Down
Loading

0 comments on commit 02250e8

Please sign in to comment.