Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit fd3a80f

Browse files
author
Benjamin O'Brien
committed
Character setup
1 parent bad4138 commit fd3a80f

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Modules
2+
import discord
3+
from assets.prism import Tools
4+
from discord.ext import commands
5+
6+
# Command class
7+
class Character(commands.Cog):
8+
9+
def __init__(self, bot):
10+
11+
self.bot = bot
12+
self.desc = "Are there in germany, there are fast cars. IN GERMANY, THERE ARE PARTY PEOPLE. AT HALF PAST FOUR. THERE ARE GERMAN TRUCKS: SCANIA, IVECO, VOLVO, MAN, DAF. AT HALF PAST FOUR! THERE ARE HOSEPOWER- 300, 700, 900. 4 AM. BRATWURST WITH A LARGE BEER, AT HALF PAST FOUR. AVAILABLE IN GERMANY."
13+
self.usage = "character"
14+
15+
def create_connection(self):
16+
17+
"""Connects to the SQLite database"""
18+
19+
conn = sqlite3.connect("db/characters.db")
20+
21+
cursor = conn.cursor()
22+
23+
self.db_conn = conn # make it so save works
24+
25+
return cursor
26+
27+
def save(self):
28+
29+
"""Save the database"""
30+
31+
if not self.db_conn:
32+
33+
raise ValueError("PrismErrDatabase391-There is no database connected.")
34+
35+
self.db_conn.commit()
36+
37+
self.db_conn.close()
38+
39+
def fetch_character(self, id):
40+
41+
"""Create a link to the character database and fetch their information"""
42+
43+
c = self.create_connection()
44+
45+
self.save()
46+
47+
return None # very very temporary
48+
49+
@commands.command(aliases = ["char"])
50+
async def character(self, ctx):
51+
52+
# bruh moment
53+
character = self.fetch_character(ctx.author.id)
54+
55+
if not character:
56+
57+
return await ctx.send(embed = Tools.error("hi"))
58+
59+
return await ctx.send(character)
60+
61+
# Link to bot
62+
def setup(bot):
63+
64+
bot.add_cog(Character(bot))

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ dblpy
22
psutil
33
requests
44
termcolor
5+
youtube-dl
56
wolframalpha
67
python-dotenv
78
discord.py>=1.3.4

0 commit comments

Comments
 (0)