-
Notifications
You must be signed in to change notification settings - Fork 27
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
8 changed files
with
80 additions
and
4 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,25 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: akhileshns/heroku-deploy@v3.12.12 # This is the action | ||
with: | ||
heroku_api_key: ${{ secrets.HEROKU_API_KEY }} | ||
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }} | ||
heroku_email: ${{ secrets.HEROKU_EMAIL }} | ||
region: eu | ||
env: | ||
HD_bot_token: ${{ secrets.bot_token }} | ||
HD_allowed_user_ids: ${{ secrets.allowed_user_ids }} | ||
HD_db_url: ${{ secrets.db_url }} | ||
HD_G_DRIVE_CLIENT_ID: ${{ secrets.G_DRIVE_CLIENT_ID }} | ||
HD_G_DRIVE_CLIENT_SECRET : ${{ secrets.G_DRIVE_CLIENT_SECRET }} | ||
HD_prefix : ${{ secrets.prefix }} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
*__pycache__* | ||
_config.py | ||
temporary/ | ||
venv/ | ||
log.txt | ||
.env |
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 @@ | ||
worker: python main.py |
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,11 @@ | ||
from dotenv import load_dotenv | ||
import os | ||
load_dotenv() | ||
|
||
bot_token = os.getenv('bot_token') | ||
temp_allowed_uid = os.getenv('allowed_user_ids').split(',') | ||
allowed_user_ids = list(map(int,[i for i in temp_allowed_uid if i!= ''])) | ||
db_url = os.getenv('db_url') | ||
G_DRIVE_CLIENT_ID = os.getenv('G_DRIVE_CLIENT_ID') | ||
G_DRIVE_CLIENT_SECRET = os.getenv('G_DRIVE_CLIENT_SECRET') | ||
prefix = os.getenv('prefix') |
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,37 @@ | ||
"""Imports""" | ||
import discord | ||
import os | ||
from discord.ext import commands | ||
from cogs._helpers import is_allowed,embed | ||
from cogs._config import prefix | ||
|
||
class General(commands.Cog): | ||
"""General commands""" | ||
|
||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
async def cog_before_invoke(self, ctx): | ||
""" | ||
Triggers typing indicator on Discord before every command. | ||
""" | ||
await ctx.trigger_typing() | ||
return | ||
|
||
@commands.command(description=f'Checks the ping of the bot.\n`{prefix}ping`') | ||
async def ping(self,ctx): | ||
await ctx.send(f'🏓 Pong! Latency: {round(self.bot.latency*1000)}ms') | ||
|
||
@is_allowed() | ||
@commands.command(description=f'Sends the log file\n`{prefix}log`') | ||
async def log(self,ctx): | ||
if os.path.exists('log.txt'): | ||
await ctx.send(embed=embed('📃 Log File','Here is the log file')[0],file=discord.File('log.txt')) | ||
else: | ||
await ctx.send(embed=embed('📃 Log File','No logfile found :(')[0]) | ||
|
||
|
||
|
||
def setup(bot): | ||
bot.add_cog(General(bot)) | ||
print("General cog is loaded") |
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