diff --git a/README.md b/README.md index eadaaa7..ebf6a3e 100644 --- a/README.md +++ b/README.md @@ -40,4 +40,12 @@ Currently supports: Features: * Separate approved and denied channels - * Custom emoji support \ No newline at end of file + * Custom emoji support + + ## SugonCredit +Implements a way for moderators to give out social-credit like points, dubbed 'sugoncredits' by the community. + +Features: +* Add Credit to people. +* Remove Credit from people. +* Supports custom currency names and bank names. \ No newline at end of file diff --git a/podcast/podcast.py b/podcast/podcast.py index 9a753b1..5e61762 100644 --- a/podcast/podcast.py +++ b/podcast/podcast.py @@ -46,13 +46,13 @@ class Podcast(commands.Cog): """Commands to configure the Podcast cog.""" @podcastset.command(name="global") - async def set_global_mode(self, ctx, boolean: bool): + async def set_global_mode(self, ctx, enabled: bool): """Enables or disables global mode.""" - if boolean == True: + if enabled == True: await self.config.guild(ctx.guild).global_mode.set(True) - await ctx.send(content="``global_mode`` has been set to True.") - elif boolean == False: + await ctx.send(content="``global_mode`` has been enabled.") + elif enabled == False: await self.config.guild(ctx.guild).global_mode.set(False) - await ctx.send(content="``global_mode`` has been set to False.") + await ctx.send(content="``global_mode`` has been disabled.") else: await ctx.send(content="Please specify an argument!") \ No newline at end of file diff --git a/sugoncredit/__init__.py b/sugoncredit/__init__.py new file mode 100644 index 0000000..ee1103f --- /dev/null +++ b/sugoncredit/__init__.py @@ -0,0 +1,5 @@ +from .sugoncredit import SugonCredit + + +def setup(bot): + bot.add_cog(SugonCredit(bot)) diff --git a/sugoncredit/info.json b/sugoncredit/info.json new file mode 100644 index 0000000..3077f64 --- /dev/null +++ b/sugoncredit/info.json @@ -0,0 +1,9 @@ +{ + "author" : ["SeaswimmerTheFsh"], + "install_msg" : "Thank you for installing SugonCredit!\n**Please load the Bank cog before loading this cog.**\nYou can find the source code of this cog here: https://github.com/SeaswimmerTheFsh/GalaxyCogs.", + "name" : "SugonCredit", + "short" : "Simple points system.", + "description" : "Implements a way for moderators to give out social-credit like points, dubbed 'sugoncredits' by the community.", + "tags" : ["bank"], + "end_user_data_statement": "This cog stores no end user data." +} diff --git a/sugoncredit/sugoncredit.py b/sugoncredit/sugoncredit.py new file mode 100644 index 0000000..4b70932 --- /dev/null +++ b/sugoncredit/sugoncredit.py @@ -0,0 +1,65 @@ +import discord +from redbot.core import commands, bank, checks + +class SugonCredit(commands.cog): + """Implements a way for moderators to give out social-credit like points, dubbed 'sugoncredits' by the community.""" + def __init__(self, bot): + self.bot = bot + + @commands.group(autohelp=True, aliases=["sugoncredit"]) + @commands.guild_only() + async def credit(self): + """Simple points system.""" + + @credit.command() + @commands.guild_only() + async def balance(self, ctx, user: discord.Member = None): + """Checks an account's balance.""" + bank_name = await bank.get_bank_name(ctx.guild) + currency_name = await bank.get_currency_name(ctx.guild) + if user == None: + bal = await bank.get_balance(ctx.author) + target = ctx.author + else: + bal = await bank.get_balance(user) + target = user + if bal == 1 or bal == -1: + embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {bal} {currency_name}.") + else: + embed=discord.Embed(title=f"{bank_name} - Balance", color=await self.bot.get_embed_color(None), description=f"{target.mention} has {bal} {currency_name}s.") + await ctx.send(embed=embed) + + @credit.command() + @commands.guild_only() + @commands.mod() + async def add(self, ctx, target: discord.Member, amount: int): + """Adds credits to an account.""" + bank_name = await bank.get_bank_name(ctx.guild) + currency_name = await bank.get_currency_name(ctx.guild) + current_bal = await bank.get_balance(target) + max_bal = await bank.get_max_balance(ctx.guild) + new_bal = current_bal + amount + if new_bal > max_bal: + await ctx.send(content=f"You are attempting to set {target.mention}'s balance to above {max.bal}. Please try again!") + return + else: + embed=discord.Embed(title=f"{bank_name} - Add", color=await self.bot.get_embed_color(None), description=f"{target.mention}'s {currency_name} balance has been increased by {amount}.\nCurrent balance is {new_bal}.") + bank.deposit_credits(target, amount=amount) + await ctx.send(embed=embed) + + @credit.command() + @commands.guild_only() + @commands.mod() + async def remove(self, ctx, target: discord.Member, amount: int): + """Removes credits from an account.""" + bank_name = await bank.get_bank_name(ctx.guild) + currency_name = await bank.get_currency_name(ctx.guild) + current_bal = await bank.get_balance(target) + new_bal = current_bal - amount + if new_bal < 1: + await ctx.send(content=f"You are attempting to set {target.mention}'s balance to below 1. Please try again!") + return + else: + embed=discord.Embed(title=f"{bank_name} - Remove", color=await self.bot.get_embed_color(None), description=f"{target.mention}'s {currency_name} balance has been decreased by {amount}.\nCurrent balance is {new_bal}.") + bank.withdraw_credits(target, amount=amount) + await ctx.send(embed=embed) \ No newline at end of file