-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
314 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
lint: | ||
name: Run linters | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Install Python dependencies | ||
run: pip install black flake8 | ||
|
||
- name: Run linters | ||
uses: wearerequired/lint-action@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
black: true | ||
flake8: true | ||
auto_fix: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Changelog | ||
|
||
## [1.0.0] - 2021-01-10 | ||
|
||
### Added | ||
- **Added support for tracking website uptime in montoring.** | ||
- **Added http command for manual checking of website uptime.** | ||
- Added more type hints and data types for function parameters | ||
- Linting workflow for PRs and master releases | ||
- More annotations for commands | ||
- Added logging | ||
|
||
### Changed | ||
- **No longer need to reload the bot to update the config files.** | ||
- Status command moved into the monitor cog. | ||
- Status command and up/down notifications now show monitor type. | ||
- Discord.py upgraded to 1.6 and aiohttp bumped to 3.7.3 | ||
- Main file renamed to `bot.py` | ||
|
||
[1.0.0]: https://github.com/finlaysawyer/discord-uptime/compare/v0.0.1...v1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import logging | ||
import os | ||
import sys | ||
|
||
from discord import Intents | ||
from discord.ext import commands | ||
|
||
from utils.config import get_config | ||
|
||
bot = commands.Bot(command_prefix=get_config("prefix")) | ||
logging.basicConfig( | ||
format="%(levelname)s | %(asctime)s | %(name)s | %(message)s", | ||
stream=sys.stdout, | ||
level=logging.INFO, | ||
) | ||
|
||
|
||
class DiscordUptime(commands.Bot): | ||
def __init__(self): | ||
super().__init__( | ||
command_prefix=get_config("prefix"), | ||
description="Bot to monitor uptime of services", | ||
reconnect=True, | ||
intents=Intents.default(), | ||
) | ||
self.bot = bot | ||
|
||
async def on_ready(self): | ||
print(f"Logged in as {self.user}") | ||
|
||
for filename in os.listdir("./cogs"): | ||
if filename.endswith(".py"): | ||
self.load_extension(f"cogs.{filename[:-3]}") | ||
|
||
async def on_command_error(self, ctx, error): | ||
if isinstance(error, (commands.BadArgument, commands.MissingRequiredArgument)): | ||
return await ctx.send(error) | ||
else: | ||
return | ||
|
||
|
||
if __name__ == "__main__": | ||
DiscordUptime().run(get_config("token")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.