Skip to content

Commit

Permalink
Add terminal colours
Browse files Browse the repository at this point in the history
  • Loading branch information
kyb3r committed Dec 30, 2018
1 parent 44115b9 commit 0151cbb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
37 changes: 21 additions & 16 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@
import re
import io

from colorama import init, Fore, Back, Style

init()

from discord.ext import commands
import discord
import aiohttp

from utils.paginator import PaginatorSession
from utils.api import Github, ModmailApiClient



line = Fore.RED + Style.BRIGHT + '-------------------------' + Style.RESET_ALL

class Modmail(commands.Bot):

def __init__(self):
Expand All @@ -58,17 +66,17 @@ def __init__(self):
def _add_commands(self):
'''Adds commands automatically'''
self.remove_command('help')
print('-------------------------')
print('┌┬┐┌─┐┌┬┐┌┬┐┌─┐┬┬',
print(line)
print(Fore.YELLOW + '┌┬┐┌─┐┌┬┐┌┬┐┌─┐┬┬',
'││││ │ │││││├─┤││',
'┴ ┴└─┘─┴┘┴ ┴┴ ┴┴┴─┘', sep='\n')
print(f'v{__version__}')
print('Author: kyb3r')
print('Author: kyb3r' + Style.RESET_ALL)
for attr in dir(self):
cmd = getattr(self, attr)
if isinstance(cmd, commands.Command):
self.add_command(cmd)

@property
def config(self):
try:
Expand Down Expand Up @@ -113,16 +121,13 @@ async def wrapper(self, ctx, *args, **kwargs):
return wrapper

async def on_connect(self):
print('-------------------------')
print('Connected to gateway.')
print(line)
print(Fore.YELLOW + 'Connected to gateway.')

self.session = aiohttp.ClientSession()
status = os.getenv('STATUS') or self.config.get('STATUS')
if status:
print(f'Changing presence.')
await self.change_presence(activity=discord.Game(status))
else:
print('No status set.')

@property
def guild_id(self):
Expand All @@ -136,13 +141,13 @@ def guild(self):
async def on_ready(self):
'''Bot startup, sets uptime.'''
print(textwrap.dedent(f'''
-------------------------
Client ready.
-------------------------
Logged in as: {self.user}
User ID: {self.user.id}
Guild ID: {self.guild.id if self.guild else 0}
-------------------------
{line}
{Fore.YELLOW}Client ready.
{line}
{Fore.YELLOW}Logged in as: {self.user}
{Fore.YELLOW}User ID: {self.user.id}
{Fore.YELLOW}Guild ID: {self.guild.id if self.guild else 0}
{line}
''').strip())

async def on_message(self, message):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
git+https://github.com/Rapptz/discord.py@rewrite
yarl==1.1.1
colorama

0 comments on commit 0151cbb

Please sign in to comment.