Checking if the server works on the bot

pull/4/head
sgoudham 4 years ago
parent e4f15ba1b7
commit 31b0d8b0f0

@ -5,6 +5,8 @@ from PIL import Image, ImageDraw, ImageFont
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import command, cooldown, BucketType from discord.ext.commands import command, cooldown, BucketType
import db
def generate_meme(image_path, top_text, bottom_text='', font_path='homies/impact/impacted.ttf', font_size=9): def generate_meme(image_path, top_text, bottom_text='', font_path='homies/impact/impacted.ttf', font_size=9):
get_image = Image.open(image_path) get_image = Image.open(image_path)
@ -50,10 +52,14 @@ class Fun(commands.Cog):
self.bot = bot self.bot = bot
@command(name="homies", aliases=["Homies", "homie", "Homie"]) @command(name="homies", aliases=["Homies", "homie", "Homie"])
@cooldown(1, 180, BucketType.channel) @cooldown(1, 25, BucketType.guild)
async def homies(self, ctx, *, user_word): async def homies(self, ctx, *, user_word):
"""Allows people to summon the homies""" """Allows people to summon the homies"""
conn = db.connection()
if conn:
print("Yes server is working!")
if len(user_word) >= 20: if len(user_word) >= 20:
await ctx.send("Please make sure the prompt is below **20** characters!") await ctx.send("Please make sure the prompt is below **20** characters!")
return return

11
db.py

@ -10,13 +10,14 @@ def connection():
# Connect to MariaDB Platform # Connect to MariaDB Platform
try: try:
conn = mariadb.connect( conn = mariadb.connect(
user="u67_i1Lq7r8fQ2", user="root",
password=password, password=password,
host="216.155.135.248", host="173.208.202.20",
port=3306, port=3306,
database="s67_Enso" database="enso"
) )
if conn:
print("working")
except mariadb.Error as e: except mariadb.Error as e:
print(f"Error connecting to MariaDB Platform: {e}") print(f"Error connecting to MariaDB Platform: {e}")
sys.exit(1) sys.exit(1)
@ -24,6 +25,8 @@ def connection():
return conn return conn
connection()
"""if conn: """if conn:
print("Connected to MySQL Server version ") print("Connected to MySQL Server version ")
cursor = conn.cursor() cursor = conn.cursor()

Loading…
Cancel
Save