[Reminder] Allow footer and title modification

Module will be more more flexible
This commit is contained in:
Harsha Raghu
2022-01-18 21:12:48 +05:30
parent c01de167f3
commit 19816198b0
4 changed files with 12 additions and 3 deletions

View File

@@ -3,6 +3,6 @@ from data.interfaces import RowTable
reminders = RowTable( reminders = RowTable(
'reminders', 'reminders',
('reminderid', 'userid', 'remind_at', 'content', 'message_link', 'interval', 'created_at'), ('reminderid', 'userid', 'remind_at', 'content', 'message_link', 'interval', 'created_at', 'title', 'footer'),
'reminderid' 'reminderid'
) )

View File

@@ -150,7 +150,7 @@ class Reminder:
# Build the message embed # Build the message embed
embed = discord.Embed( embed = discord.Embed(
title="You asked me to remind you!", title="You asked me to remind you!" if self.data.title is None else self.data.title,
colour=discord.Colour.orange(), colour=discord.Colour.orange(),
description=self.data.content, description=self.data.content,
timestamp=datetime.datetime.utcnow() timestamp=datetime.datetime.utcnow()
@@ -167,6 +167,9 @@ class Reminder:
) )
) )
if self.data.footer:
embed.set_footer(text=self.data.footer)
# Update the reminder data, and reschedule if required # Update the reminder data, and reschedule if required
if self.data.interval: if self.data.interval:
next_time = self.data.remind_at + datetime.timedelta(seconds=self.data.interval) next_time = self.data.remind_at + datetime.timedelta(seconds=self.data.interval)

View File

@@ -1,6 +1,10 @@
ALTER TABLE user_config ALTER TABLE user_config
ADD COLUMN remaind_upvote BOOLEAN DEFAULT TRUE ADD COLUMN remaind_upvote BOOLEAN DEFAULT TRUE
ALTER TABLE reminders
ADD COLUMN title TEXT DEFAULT NULL,
ADD COLUMN footer TEXT DEFAULT NULL
-- Topgg Data {{{ -- Topgg Data {{{
CREATE TABLE IF NOT EXISTS topgg( CREATE TABLE IF NOT EXISTS topgg(
voteid SERIAL PRIMARY KEY, voteid SERIAL PRIMARY KEY,

View File

@@ -167,7 +167,9 @@ CREATE TABLE reminders(
content TEXT NOT NULL, content TEXT NOT NULL,
message_link TEXT, message_link TEXT,
interval INTEGER, interval INTEGER,
created_at TIMESTAMP DEFAULT (now() at time zone 'utc') created_at TIMESTAMP DEFAULT (now() at time zone 'utc'),
title TEXT DEFAULT NULL,
footer TEXT DEFAULT NULL
); );
CREATE INDEX reminder_users ON reminders (userid); CREATE INDEX reminder_users ON reminders (userid);
-- }}} -- }}}