Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #22 from parafoxia/develop
Browse files Browse the repository at this point in the history
Merge beta.3 version
  • Loading branch information
parafoxia authored Aug 10, 2020
2 parents 5d26eac + b6fd4bc commit 533eb80
Show file tree
Hide file tree
Showing 60 changed files with 385 additions and 292 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ $RECYCLE.BIN/
*.lnk

### Custom ###
.images/.dev/
secrets/
*.db3
*.db3-journal
*.db3-shm
*.db3-wal
TODO
Binary file added .images/avatar-beta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/cancel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/confirm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/option1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/option2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/option3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/option4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/option5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/option6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/option7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/option8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/option9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/pageback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/pagenext.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/stepback.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/emoji/stepnext.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .images/loading500.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ RUN $HOME/.poetry/bin/poetry install --no-ansi --no-root --no-dev
COPY . .
RUN $HOME/.poetry/bin/poetry install --no-ansi --no-dev

CMD ["python3", "-m", "s4"]
CMD ["python3", "-m", "solaris"]
64 changes: 62 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,62 @@
# S4
Server Safety and Security Systems designed to make your server a safer and better place.
# Solaris
A Discord bot designed to make your server a safer and better place.

# Cloning and running
I would greatly prefer if you invited Solaris to your server [here](https://discordapp.com/oauth2/authorize?client_id=661972684153946122&scope=bot&permissions=8) rather than run your own instance. With that being said, you are able to clone Solaris to your machine in order to test it or contribute.

Solaris was also not designed with universal compatibility in mind. If you want to include sections of Solaris' code in your own program, you will likely need to make significant modifications. Make sure you abide by the terms of the license, which you can find in LICENSE.

**Note:** As of v1.0.0-beta.3, these instructions haven't been fully tested. If they are wrong, open an issue.

## Running with Docker
**Warning**: Docker functionality in Solaris was designed specifically with Debian 10 Buster in mind. If you are using another OS, you may need to modify the Dockerfile.

### Requirements
- docker
- docker-compose

### Setup
1. `cd` into the root directory (the one with this README in it).
2. Run `mkdir secrets`.
3. Create a file called "token" in the "/secrets" directory.
4. Copy and paste your bot's token into the "token" file.
5. `cd` back into the root directory.
6. Run `docker-compose build`.

**Note:** You may need to create a `[root]/solaris/data/dynamic` directory for the build to be successful.

### Running
1. `cd` into the root directory (the one with this README in it).
2. Run `docker-compose up`.
- To run silently, use the `-d` flag.

## Running inside a virtual environment
You should be able to run Solaris using this method on any OS.

### Requirements
- Python 3.8.0 or above

### Setup
1. `cd` into the root directory (the one with this README in it).
2. Create a file called ".env" in this directory.
3. Populate the ".env" file using the following template. Note that all but `TOKEN` are optional.
```
TOKEN="xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxx"
DEFAULT_PREFIX=">>"
HUB_GUILD_ID=<guild id>
HUB_COMMANDS_CHANNEL_ID=<channel id>
HUB_RELAY_CHANNEL_ID=<channel id>
HUB_STDOUT_CHANNEL_ID=<channel id>
```
4. Run `py -3 -m pip install poetry`.
- You may need to use a different `pip` command depending on your Python configuration.
5. Run `py -3 -m venv ./.venv`.
6. Run `./.venv/Scripts/activate`.
7. Run `poetry install`.
### Running
1. `cd` into the root directory (the one with this README in it).
2. Run `py -3 -m solaris`.
# Links
[Invite Solaris to your server](https://discordapp.com/oauth2/authorize?client_id=661972684153946122&scope=bot&permissions=8) • [Invite Solaris to your server (non-admin privileges)](https://discordapp.com/oauth2/authorize?client_id=661972684153946122&scope=bot&permissions=403008598) • [Join the Solaris support server](https://discord.gg/c3b4cZs) • [See Solaris in action](https://discord.carberra.xyz)
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tool.poetry]
name = "S4-Server-Safety-Security-Systems"
version = "1.0.0-beta.2"
description = "Server Safety and Security Systems designed to make your server a safer and better place."
name = "Solaris-Bot"
version = "1.0.0-beta.3"
description = "A Discord bot designed to make your server a safer and better place."

license = "GPLv3"
repository = "https://github.com/parafoxia/S4"
repository = "https://github.com/parafoxia/Solaris"
readme = "README.md"

authors = [
Expand Down
6 changes: 3 additions & 3 deletions s4/__init__.py → solaris/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# S4 - A security and statistics focussed Discord bot.
# Solaris - A Discord bot designed to make your server a safer and better place.
# Copyright (C) 2020 Ethan Henderson

# This program is free software: you can redistribute it and/or modify
Expand All @@ -21,9 +21,9 @@

from toml import loads

from s4.config import Config
from solaris.config import Config

# Dependant on above imports.
from s4.bot import Bot
from solaris.bot import Bot

__version__ = loads(open(Path(__name__).resolve().parents[0] / "pyproject.toml").read())["tool"]["poetry"]["version"]
4 changes: 2 additions & 2 deletions s4/__main__.py → solaris/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# S4 - A security and statistics focussed Discord bot.
# Solaris - A Discord bot designed to make your server a safer and better place.
# Copyright (C) 2020 Ethan Henderson

# This program is free software: you can redistribute it and/or modify
Expand All @@ -17,7 +17,7 @@
# Ethan Henderson
# [email protected]

from s4 import Bot, __version__
from solaris import Bot, __version__


def main():
Expand Down
2 changes: 1 addition & 1 deletion s4/bot/__init__.py → solaris/bot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# S4 - A security and statistics focussed Discord bot.
# Solaris - A Discord bot designed to make your server a safer and better place.
# Copyright (C) 2020 Ethan Henderson

# This program is free software: you can redistribute it and/or modify
Expand Down
22 changes: 11 additions & 11 deletions s4/bot/bot.py → solaris/bot/bot.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# S4 - A security and statistics focussed Discord bot.
# Solaris - A Discord bot designed to make your server a safer and better place.
# Copyright (C) 2020 Ethan Henderson

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# T2his program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Expand All @@ -25,17 +25,17 @@
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from discord.ext import commands

from s4 import Config, utils
from s4.db import Database
from s4.utils import loc
from solaris import Config, utils
from solaris.db import Database
from solaris.utils import loc


class Bot(commands.Bot):
def __init__(self, version):
self.version = version
self._cogs = [p.stem for p in Path(".").glob("./s4/bot/cogs/*.py")]
self._dynamic = "./s4/data/dynamic"
self._static = "./s4/data/static"
self._cogs = [p.stem for p in Path(".").glob("./solaris/bot/cogs/*.py")]
self._dynamic = "./solaris/data/dynamic"
self._static = "./solaris/data/static"

self.scheduler = AsyncIOScheduler()
self.db = Database(self)
Expand All @@ -53,7 +53,7 @@ def setup(self):
print("Running setup...")

for cog in self._cogs:
self.load_extension(f"s4.bot.cogs.{cog}")
self.load_extension(f"solaris.bot.cogs.{cog}")
print(f" Loaded `{cog}` cog.")

print("Setup complete.")
Expand All @@ -74,7 +74,7 @@ async def shutdown(self):

hub = self.get_cog("Hub")
if (sc := getattr(hub, "stdout_channel", None)) is not None:
await sc.send(f"{self.info} S4 is shutting down. (Version {self.version})")
await sc.send(f"{self.info} Solaris is now shutting down. (Version {self.version})")

print(" Closing connection to Discord...")
await self.logout()
Expand Down Expand Up @@ -134,7 +134,7 @@ async def process_commands(self, msg):
await self.invoke(ctx)
else:
await ctx.send(
f"{self.cross} S4 is still booting and is not ready to receive commands. Please try again later."
f"{self.cross} Solaris is still booting and is not ready to receive commands. Please try again later."
)

async def on_message(self, msg):
Expand Down
14 changes: 7 additions & 7 deletions s4/bot/cogs/error.py → solaris/bot/cogs/error.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# S4 - A security and statistics focussed Discord bot.
# Solaris - A Discord bot designed to make your server a safer and better place.
# Copyright (C) 2020 Ethan Henderson

# This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -28,7 +28,7 @@
from discord import File, Forbidden, HTTPException
from discord.ext import commands

from s4.utils import chron, string
from solaris.utils import chron, string


class Error(commands.Cog):
Expand Down Expand Up @@ -90,15 +90,15 @@ async def command_error(self, ctx, exc):
try:
mp = string.list_of([str(perm.replace("_", " ")).title() for perm in exc.missing_perms], sep="or")
await ctx.send(
f"{self.bot.cross} S4 does not have the {mp} permission(s), which are required to use this command."
f"{self.bot.cross} Solaris does not have the {mp} permission(s), which are required to use this command."
)
except Forbidden:
# If S4 does not have the Send Messages permission
# If Solaris does not have the Send Messages permission
# (might redirect this to log channel once it's set up).
pass

elif isinstance(exc, commands.NotOwner):
await ctx.send(f"{self.bot.cross} That command can only be used by S4's owner.")
await ctx.send(f"{self.bot.cross} That command can only be used by Solaris' owner.")

elif isinstance(exc, commands.CommandOnCooldown):
# Hooray for discord.py str() logic.
Expand All @@ -117,11 +117,11 @@ async def command_error(self, ctx, exc):

elif isinstance(exc, commands.InvalidEndOfQuotedStringError):
await ctx.send(
f"{self.bot.cross} S4 expected a space after the closing quote, but found a(n) `{exc.char}` instead."
f"{self.bot.cross} Solaris expected a space after the closing quote, but found a(n) `{exc.char}` instead."
)

elif isinstance(exc, commands.ExpectedClosingQuoteError):
await ctx.send(f"{self.bot.cross} S4 expected a closing quote character, but did not find one.")
await ctx.send(f"{self.bot.cross} Solaris expected a closing quote character, but did not find one.")

# Base errors.
elif isinstance(exc, commands.UserInputError):
Expand Down
Loading

0 comments on commit 533eb80

Please sign in to comment.