Skip to content

Commit 0151cbb

Browse files
committed
Add terminal colours
1 parent 44115b9 commit 0151cbb

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

bot.py

+21-16
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,21 @@
4040
import re
4141
import io
4242

43+
from colorama import init, Fore, Back, Style
44+
45+
init()
46+
4347
from discord.ext import commands
4448
import discord
4549
import aiohttp
4650

4751
from utils.paginator import PaginatorSession
4852
from utils.api import Github, ModmailApiClient
4953

54+
55+
56+
line = Fore.RED + Style.BRIGHT + '-------------------------' + Style.RESET_ALL
57+
5058
class Modmail(commands.Bot):
5159

5260
def __init__(self):
@@ -58,17 +66,17 @@ def __init__(self):
5866
def _add_commands(self):
5967
'''Adds commands automatically'''
6068
self.remove_command('help')
61-
print('-------------------------')
62-
print('┌┬┐┌─┐┌┬┐┌┬┐┌─┐┬┬',
69+
print(line)
70+
print(Fore.YELLOW + '┌┬┐┌─┐┌┬┐┌┬┐┌─┐┬┬',
6371
'││││ │ │││││├─┤││',
6472
'┴ ┴└─┘─┴┘┴ ┴┴ ┴┴┴─┘', sep='\n')
6573
print(f'v{__version__}')
66-
print('Author: kyb3r')
74+
print('Author: kyb3r' + Style.RESET_ALL)
6775
for attr in dir(self):
6876
cmd = getattr(self, attr)
6977
if isinstance(cmd, commands.Command):
7078
self.add_command(cmd)
71-
79+
7280
@property
7381
def config(self):
7482
try:
@@ -113,16 +121,13 @@ async def wrapper(self, ctx, *args, **kwargs):
113121
return wrapper
114122

115123
async def on_connect(self):
116-
print('-------------------------')
117-
print('Connected to gateway.')
124+
print(line)
125+
print(Fore.YELLOW + 'Connected to gateway.')
118126

119127
self.session = aiohttp.ClientSession()
120128
status = os.getenv('STATUS') or self.config.get('STATUS')
121129
if status:
122-
print(f'Changing presence.')
123130
await self.change_presence(activity=discord.Game(status))
124-
else:
125-
print('No status set.')
126131

127132
@property
128133
def guild_id(self):
@@ -136,13 +141,13 @@ def guild(self):
136141
async def on_ready(self):
137142
'''Bot startup, sets uptime.'''
138143
print(textwrap.dedent(f'''
139-
-------------------------
140-
Client ready.
141-
-------------------------
142-
Logged in as: {self.user}
143-
User ID: {self.user.id}
144-
Guild ID: {self.guild.id if self.guild else 0}
145-
-------------------------
144+
{line}
145+
{Fore.YELLOW}Client ready.
146+
{line}
147+
{Fore.YELLOW}Logged in as: {self.user}
148+
{Fore.YELLOW}User ID: {self.user.id}
149+
{Fore.YELLOW}Guild ID: {self.guild.id if self.guild else 0}
150+
{line}
146151
''').strip())
147152

148153
async def on_message(self, message):

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
git+https://github.com/Rapptz/discord.py@rewrite
2-
yarl==1.1.1
2+
colorama

0 commit comments

Comments
 (0)