From ef03866a032ffabc6b8c699dfd827b8a676e2248 Mon Sep 17 00:00:00 2001 From: phixxy Date: Sat, 16 Mar 2024 00:49:36 -0700 Subject: [PATCH] add/remove supporter commands --- cogs/donate.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cogs/donate.py b/cogs/donate.py index 8bb60c1..348fb57 100644 --- a/cogs/donate.py +++ b/cogs/donate.py @@ -10,6 +10,7 @@ class Donate(commands.Cog): def __init__(self, bot): self.bot = bot + self.admin_id = 242018983241318410 self.donation_link = "https://patreon.com/phixxy" self.data_dir = "data/donate/" self.donor_file = "data/donate/supporters.txt" @@ -31,6 +32,26 @@ class Donate(commands.Cog): async def donate(self, ctx): await ctx.send(f"If you would like to support the future of this bot please consider donating here: {self.donation_link}") + @commands.command() + async def add_supporter(self, ctx, username: str): + if ctx.author.id != self.admin_id: + return + with open(self.donor_file, 'a') as f: + f.write(f"{username}\n") + await ctx.send(f"Added {username} to supporters") + + @commands.command() + async def remove_supporter(self, ctx, username: str): + if ctx.author.id != self.admin_id: + return + with open(self.donor_file, 'r') as f: + supporters = f.readlines() + with open(self.donor_file, 'w') as f: + for line in supporters: + if line!= username: + f.write(line) + await ctx.send(f"Removed {username} from supporters") + @commands.command( description="Supporters", help="Get information on who supports this bot.",