diff --git a/README.md b/README.md index 7c516ae..e823411 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,19 @@ Cog Function | hangman | **Alpha** |
Play a game of hangmanSome visual glitches and needs more customization
| | howdoi | **Incomplete** |
Ask coding questions and get results from StackExchangeNot yet functional
| | leaver | **Alpha** |
Send a message in a channel when a user leaves the serverJust released, please report bugs
| +| lovecalculator | **Alpha** |
Calculate the love between two users[Snap-Ons] Just updated to V3
| | lseen | **Alpha** |
Track when a member was last onlineAlpha release, please report bugs
| +| qrinvite | **Alpha** |
Create a QR code invite for the serverAlpha release, please report any bugs
| | reactrestrict | **Alpha** |
Removes reactions by role per channelA bit clunky, but functional
| +| recyclingplant | **Alpha** |
Work at a recycling plant[Snap-Ons] Just updated to V3
| +| rpsls | **Alpha** |
Play Rock-Paper-Scissors-Lizard-Spock[Snap-Ons] Just updated to V3
| | sayurl | **Alpha** |
Convert any URL into text and post to discordNo error checking and pretty spammy
| +| scp | **Alpha** |
Look-up SCP articles[Snap-Ons] Just updated to V3
| | secrethitler | **Incomplete** |
Play the Secret Hitler gameConcept, no work done yet
| | stealemoji | **Alpha** |
Steals any custom emoji it sees in a reactionSome planned upgrades for server generation
| | timerole | **Alpha** |
Add roles to members after specified time on the serverUpgraded from V2, please report any bugs
| | tts | **Alpha** |
Send a Text-to-Speech message as an uploaded mp3Alpha release, please report any bugs
| -| qrinvite | **Alpha** |
Create a QR code invite for the serverAlpha release, please report any bugs
| +| unicode | **Alpha** |
Encode and Decode unicode characters[Snap-Ons] Just updated to V3
| | werewolf | **Alpha** |
Play the classic party game Werewolf within discordAnother massive project currently being developed, will be fully customizable
| diff --git a/lovecalculator/__init__.py b/lovecalculator/__init__.py new file mode 100644 index 0000000..5284684 --- /dev/null +++ b/lovecalculator/__init__.py @@ -0,0 +1,5 @@ +from .lovecalculator import LoveCalculator + + +def setup(bot): + bot.add_cog(LoveCalculator(bot)) diff --git a/lovecalculator/info.json b/lovecalculator/info.json new file mode 100644 index 0000000..c0cb702 --- /dev/null +++ b/lovecalculator/info.json @@ -0,0 +1,23 @@ +{ + "author": [ + "Bobloy", + "SnappyDragon" + ], + "bot_version": [ + 3, + 0, + 0 + ], + "description": "Calculate the love percentage for two users", + "hidden": false, + "install_msg": "Thank you for installing LoveCalculator. Love is in the air.", + "requirements": [ + "beautifulsoup4" + ], + "short": "Calculate love percentage", + "tags": [ + "bobloy", + "fun", + "love" + ] +} \ No newline at end of file diff --git a/lovecalculator/lovecalculator.py b/lovecalculator/lovecalculator.py new file mode 100644 index 0000000..fc2ff8d --- /dev/null +++ b/lovecalculator/lovecalculator.py @@ -0,0 +1,44 @@ +import aiohttp +import discord +from bs4 import BeautifulSoup +from redbot.core import commands + + +class LoveCalculator: + """Calculate the love percentage for two users!""" + + def __init__(self, bot): + self.bot = bot + + @commands.command(aliases=['lovecalc']) + async def lovecalculator(self, ctx: commands.Context, lover: discord.Member, loved: discord.Member): + """Calculate the love percentage!""" + + x = lover.display_name + y = loved.display_name + + url = 'https://www.lovecalculator.com/love.php?name1={}&name2={}'.format(x.replace(" ", "+"), + y.replace(" ", "+")) + async with aiohttp.ClientSession() as session: + async with session.get(url) as response: + soup_object = BeautifulSoup(await response.text(), "html.parser") + try: + description = soup_object.find('div', attrs={'class': 'result score'}).get_text().strip() + except: + description = 'Dr. Love is busy right now' + + try: + z = description[:2] + z = int(z) + if z > 50: + emoji = '❤' + else: + emoji = '💔' + title = 'Dr. Love says that the love percentage for {} and {} is:'.format(x, y) + except: + emoji = '' + title = 'Dr. Love has left a note for you.' + + description = emoji + ' ' + description + ' ' + emoji + em = discord.Embed(title=title, description=description, color=discord.Color.red()) + await ctx.send(embed=em) diff --git a/recyclingplant/__init__.py b/recyclingplant/__init__.py new file mode 100644 index 0000000..e012d18 --- /dev/null +++ b/recyclingplant/__init__.py @@ -0,0 +1,9 @@ +from redbot.core import data_manager + +from .recyclingplant import RecyclingPlant + + +def setup(bot): + plant = RecyclingPlant(bot) + data_manager.load_bundled_data(plant, __file__) + bot.add_cog(plant) diff --git a/recyclingplant/data/junk.json b/recyclingplant/data/junk.json new file mode 100644 index 0000000..c77f881 --- /dev/null +++ b/recyclingplant/data/junk.json @@ -0,0 +1,204 @@ +{ + "can": [ + { + "object": "Apple Core", + "action": "trash" + }, + { + "object": "Paper Cup", + "action": "recycle" + }, + { + "object": "Banana Peel", + "action": "trash" + }, + { + "object": "Paper Bag", + "action": "recycle" + }, + { + "object": "Old Taco", + "action": "trash" + }, + { + "object": "Newspaper", + "action": "recycle" + }, + { + "object": "Chewed Gum", + "action": "trash" + }, + { + "object": "Polythene Bag", + "action": "recycle" + }, + { + "object": "Rotten Eggs", + "action": "trash" + }, + { + "object": "Outdated Telephone Directory", + "action": "recycle" + }, + { + "object": "Stale Bread", + "action": "trash" + }, + { + "object": "Used Notebook", + "action": "recycle" + }, + { + "object": "Sour Milk", + "action": "trash" + }, + { + "object": "Old Textbook", + "action": "recycle" + }, + { + "object": "Week-Old Sandwich", + "action": "trash" + }, + { + "object": "Paper Ball", + "action": "recycle" + }, + { + "object": "Leftovers", + "action": "trash" + }, + { + "object": "Toy Car", + "action": "recycle" + }, + { + "object": "Fish Bones", + "action": "trash" + }, + { + "object": "Superhero Costume", + "action": "recycle" + }, + { + "object": "Dirty Diaper", + "action": "trash" + }, + { + "object": "Silcone Mould", + "action": "recycle" + }, + { + "object": "Mouldy Broccoli", + "action": "trash" + }, + { + "object": "TV Remote", + "action": "recycle" + }, + { + "object": "Withered Rose Bouquet", + "action": "trash" + }, + { + "object": "Paper Plate", + "action": "recycle" + }, + { + "object": "Slimy Bacon", + "action": "trash" + }, + { + "object": "Folders", + "action": "recycle" + }, + { + "object": "Fly Agaric Mushrooms", + "action": "trash" + }, + { + "object": "Phone case", + "action": "recycle" + }, + { + "object": "Napkins", + "action": "trash" + }, + { + "object": "Broken Dualshock 4 Controller", + "action": "recycle" + }, + { + "object": "Wax Paper", + "action": "trash" + }, + { + "object": "iPad", + "action": "recycle" + }, + { + "object": "Paint Can", + "action": "trash" + }, + { + "object": "Glass Bottle", + "action": "recycle" + }, + { + "object": "Light Bulb", + "action": "trash" + }, + { + "object": "Nintendo 3DS", + "action": "recycle" + }, + { + "object": "Styrofoam Container", + "action": "trash" + }, + { + "object": "Flash Cards", + "action": "recycle" + }, + { + "object": "Motor Oil Can", + "action": "trash" + }, + { + "object": "Candy Wrapper", + "action": "recycle" + }, + { + "object": "Waxed Cardboard", + "action": "trash" + }, + { + "object": "Empty Bottle", + "action": "recycle" + }, + { + "object": "Used Toilet Paper", + "action": "trash" + }, + { + "object": "Outdated Calendar", + "action": "recycle" + }, + { + "object": "Ceramic Mug", + "action": "trash" + }, + { + "object": "Plastic Cup", + "action": "recycle" + }, + { + "object": "Gift Wrapping", + "action": "trash" + }, + { + "object": "Soda Bottle", + "action": "recycle" + } + ] +} diff --git a/recyclingplant/info.json b/recyclingplant/info.json new file mode 100644 index 0000000..3ad2e58 --- /dev/null +++ b/recyclingplant/info.json @@ -0,0 +1,21 @@ +{ + "author": [ + "Bobloy", + "SnappyDragon" + ], + "bot_version": [ + 3, + 0, + 0 + ], + "description": "Apply for a job at the recycling plant! Sort out the garbage!", + "hidden": false, + "install_msg": "Thank you for installing RecyclingPlant. Start recycling today with `[p]recyclingplant`", + "requirements": [], + "short": "Apply for a job at the recycling plant!", + "tags": [ + "bobloy", + "environment", + "games" + ] +} \ No newline at end of file diff --git a/recyclingplant/recyclingplant.py b/recyclingplant/recyclingplant.py new file mode 100644 index 0000000..ce56eda --- /dev/null +++ b/recyclingplant/recyclingplant.py @@ -0,0 +1,67 @@ +import asyncio +import json +import random + +from redbot.core import bank +from redbot.core import commands +from redbot.core.data_manager import cog_data_path + + +class RecyclingPlant: + """Apply for a job at the recycling plant!""" + + def __init__(self, bot): + self.bot = bot + self.path = str(cog_data_path(self)).replace('\\', '/') + self.junk_path = self.path + "/bundled_data/junk.json" + + with open(self.junk_path) as json_data: + self.junk = json.load(json_data) + + @commands.command(aliases=["recycle"]) + async def recyclingplant(self, ctx: commands.Context): + """Apply for a job at the recycling plant!""" + x = 0 + reward = 0 + await ctx.send( + '{0} has signed up for a shift at the Recycling Plant! Type ``exit`` to terminate it early.'.format( + ctx.author.display_name)) + while x in range(0, 10): + used = random.choice(self.junk['can']) + if used['action'] == 'trash': + opp = 'recycle' + else: + opp = 'trash' + await ctx.send('``{}``! Will {} ``trash`` it or ``recycle`` it?'.format(used['object'], + ctx.author.display_name)) + + def check(m): + return m.author == ctx.author and m.channel == ctx.channel + + try: + answer = await self.bot.wait_for('message', timeout=120, check=check) + except asyncio.TimeoutError: + answer = None + + if answer is None: + await ctx.send('``{}`` fell down the conveyor belt to be sorted again!'.format(used['object'])) + elif answer.content.lower().strip() == used['action']: + await ctx.send( + 'Congratulations! You put ``{}`` down the correct chute! (**+50**)'.format(used['object'])) + reward = reward + 50 + x += 1 + elif answer.content.lower().strip() == opp: + await ctx.send('{}, you little brute, you put it down the wrong chute! (**-50**)'.format( + ctx.author.display_name)) + reward = reward - 50 + elif answer.content.lower().strip() == 'exit': + await ctx.send('{} has been relived of their duty.'.format(ctx.author.display_name)) + break + else: + await ctx.send('``{}`` fell down the conveyor belt to be sorted again!'.format(used['object'])) + else: + if reward > 0: + bank.deposit_credits(ctx.author, reward) + await ctx.send( + '{} been given **{} {}s** for your services.'.format(ctx.author.display_name, reward, + bank.get_currency_name(ctx.guild))) diff --git a/rpsls/__init__.py b/rpsls/__init__.py new file mode 100644 index 0000000..46a1600 --- /dev/null +++ b/rpsls/__init__.py @@ -0,0 +1,5 @@ +from .rpsls import RPSLS + + +def setup(bot): + bot.add_cog(RPSLS(bot)) diff --git a/rpsls/info.json b/rpsls/info.json new file mode 100644 index 0000000..fae70d3 --- /dev/null +++ b/rpsls/info.json @@ -0,0 +1,21 @@ +{ + "author": [ + "Bobloy", + "SnappyDragon" + ], + "bot_version": [ + 3, + 0, + 0 + ], + "description": "Play Rock Papers Scissor Lizard Spock by Sam Kass in Discord!", + "hidden": false, + "install_msg": "Thank you for installing RPSLP. Get started with `[p]rpsls`", + "requirements": [], + "short": "Play Rock Papers Scissor Lizard Spock in Discord!", + "tags": [ + "bobloy", + "star trek", + "games" + ] +} \ No newline at end of file diff --git a/rpsls/rpsls.py b/rpsls/rpsls.py new file mode 100644 index 0000000..7799db5 --- /dev/null +++ b/rpsls/rpsls.py @@ -0,0 +1,90 @@ +import asyncio +import random + +import discord +from redbot.core import commands + + +class RPSLS: + """Play Rock Paper Scissors Lizard Spock.""" + + weaknesses = { + "rock": [ + "paper", + "spock" + ], + "paper": [ + "scissors", + "lizard" + ], + "scissors": [ + "spock", + "rock" + ], + "lizard": [ + "scissors", + "rock" + ], + "spock": [ + "paper", + "lizard" + ] + } + + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def rpsls(self, ctx: commands.Context, choice: str): + """ + Play Rock Paper Scissors Lizard Spock by Sam Kass in Discord! + + Rules: + Scissors cuts Paper + Paper covers Rock + Rock crushes Lizard + Lizard poisons Spock + Spock smashes Scissors + Scissors decapitates Lizard + Lizard eats Paper + Paper disproves Spock + Spock vaporizes Rock + And as it has always Rock crushes Scissors + """ + + player_choice = choice.lower() + player_emote = self.get_emote(player_choice) + if player_emote is None: + await ctx.maybe_send_embed("Invalid Choice") + return + + bot_choice = random.choice(list(self.weaknesses.keys())) + bot_emote = self.get_emote(bot_choice) + message = '{} vs. {}, who will win?'.format(player_emote, bot_emote) + em = discord.Embed(description=message, color=discord.Color.blue()) + await ctx.send(embed=em) + await asyncio.sleep(2) + if player_choice in self.weaknesses[bot_choice]: + message = 'You win! :sob:' + em_color = discord.Color.green() + elif bot_choice in self.weaknesses[player_choice]: + message = 'I win! :smile:' + em_color = discord.Color.red() + else: + message = 'It\'s a draw! :neutral_face:' + em_color = discord.Color.blue() + em = discord.Embed(description=message, color=em_color) + await ctx.send(embed=em) + + def get_emote(self, choice): + if choice == 'rock': + emote = ':moyai:' + elif choice == 'spock': + emote = ':vulcan:' + elif choice == 'paper': + emote = ':page_facing_up:' + elif choice in ['scissors', 'lizard']: + emote = ':{}:'.format(choice) + else: + emote = None + return emote diff --git a/scp/__init__.py b/scp/__init__.py new file mode 100644 index 0000000..bded2a5 --- /dev/null +++ b/scp/__init__.py @@ -0,0 +1,5 @@ +from .scp import SCP + + +def setup(bot): + bot.add_cog(SCP(bot)) diff --git a/scp/info.json b/scp/info.json new file mode 100644 index 0000000..a351508 --- /dev/null +++ b/scp/info.json @@ -0,0 +1,20 @@ +{ + "author": [ + "Bobloy", + "SnappyDragon" + ], + "bot_version": [ + 3, + 0, + 0 + ], + "description": "Look up SCP articles. Warning: Some of them may be too creepy or gruesome.", + "hidden": false, + "install_msg": "You are now connected to the SCP database. You may now proceed to access the data using `[p]help SCP`", + "requirements": [], + "short": "Look up SCP articles.", + "tags": [ + "bobloy", + "gruesom" + ] +} \ No newline at end of file diff --git a/scp/scp.py b/scp/scp.py new file mode 100644 index 0000000..72b7cec --- /dev/null +++ b/scp/scp.py @@ -0,0 +1,116 @@ +import discord +from redbot.core import commands + + +class SCP: + """Look up SCP articles. Warning: Some of them may be too creepy or gruesome.""" + + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def scp(self, ctx: commands.Context, num: int): + """Look up SCP articles. + + Warning: Some of them may be too creepy or gruesome. + Reminder: You must specify a number between 1 and 4999. + """ + + # Thanks Shigbeard and Redjumpman for helping me! + + if 0 < num <= 4999: + msg = "http://www.scp-wiki.net/scp-{:03}".format(num) + c = discord.Color.green() + else: + msg = "You must specify a number between 1 and 4999." + c = discord.Color.red() + + if ctx.embed_requested(): + await ctx.send(embed=discord.Embed(description=msg, color=c)) + else: + await ctx.maybe_send_embed(msg) + + @commands.command() + async def scpj(self, ctx: commands.Context, joke: str): + """Look up SCP-Js. + + Reminder: Enter the correct name or else the resultant page will be invalid. + Use 001, etc. in case of numbers less than 100. + """ + + msg = "http://www.scp-wiki.net/scp-{}-j".format(joke) + await ctx.maybe_send_embed(msg) + + @commands.command() + async def scparc(self, ctx: commands.Context, num: int): + """Look up SCP archives. + + Warning: Some of them may be too creepy or gruesome.""" + valid_archive = ( + 13, 48, 51, 89, 91, 112, 132, 138, 157, 186, 232, 234, + 244, 252, 257, 338, 356, 361, 400, 406, 503, 515, 517, + 578, 728, 744, 776, 784, 837, 922, 987, 1023) + if num in valid_archive: + msg = "http://www.scp-wiki.net/scp-{:03}-arc".format(num) + c = discord.Color.green() + em = discord.Embed(description=msg, color=c) + else: + ttl = "You must specify a valid archive number." + msg = "{}".format(valid_archive) + c = discord.Color.red() + + em = discord.Embed(title=ttl, description=msg, color=c) + + if ctx.embed_requested(): + await ctx.send(embed=em) + else: + await ctx.maybe_send_embed(msg) + + @commands.command() + async def scpex(self, ctx: commands.Context, num: int): + """Look up explained SCP articles. + + Warning: Some of them may be too creepy or gruesome. + """ + + valid_archive = (711, 920, 1841, 1851, 1974, 2600, 4023, 8900) + if num in valid_archive: + msg = "http://www.scp-wiki.net/scp-{:03}-ex".format(num) + c = discord.Color.green() + em = discord.Embed(description=msg, color=c) + else: + ttl = "You must specify a valid archive number." + msg = "{}".format(valid_archive) + c = discord.Color.red() + + em = discord.Embed(title=ttl, description=msg, color=c) + + if ctx.embed_requested(): + await ctx.send(embed=em) + else: + await ctx.maybe_send_embed(msg) + + @commands.command() + async def anomalousitems(self, ctx: commands.Context): + """Look through the log of anomalous items.""" + + msg = "http://www.scp-wiki.net/log-of-anomalous-items" + await ctx.maybe_send_embed(msg) + + @commands.command() + async def extranormalevents(self, ctx: commands.Context): + """Look through the log of extranormal events.""" + + msg = "http://www.scp-wiki.net/log-of-extranormal-events" + await ctx.maybe_send_embed(msg) + + @commands.command() + async def unexplainedlocations(self, ctx: commands.Context): + """Look through the log of unexplained locations.""" + + msg = "http://www.scp-wiki.net/log-of-unexplained-locations" + await ctx.maybe_send_embed(msg) + + +def setup(bot): + bot.add_cog(SCP(bot)) diff --git a/unicode/__init__.py b/unicode/__init__.py new file mode 100644 index 0000000..410d42c --- /dev/null +++ b/unicode/__init__.py @@ -0,0 +1,5 @@ +from .unicode import Unicode + + +def setup(bot): + bot.add_cog(Unicode(bot)) diff --git a/unicode/info.json b/unicode/info.json new file mode 100644 index 0000000..0d8d24b --- /dev/null +++ b/unicode/info.json @@ -0,0 +1,21 @@ +{ + "author": [ + "Bobloy", + "SnappyDragon" + ], + "bot_version": [ + 3, + 0, + 0 + ], + "description": "Encode/Decode Unicode characters!", + "hidden": false, + "install_msg": "\u0048\u0065\u006c\u006c\u006f\u0021 \u0054\u0068\u0069\u0073 \u006d\u0065\u0073\u0073\u0061\u0067\u0065 \u0077\u0061\u0073 \u0077\u0072\u0069\u0074\u0074\u0065\u006e \u0069\u006e \u0055\u004e\u0049\u0043\u004f\u0044\u0045\u002e", + "requirements": [], + "short": "Encode/Decode Unicode characters!", + "tags": [ + "bobloy", + "utility", + "tools" + ] +} \ No newline at end of file diff --git a/unicode/unicode.py b/unicode/unicode.py new file mode 100644 index 0000000..4ad172a --- /dev/null +++ b/unicode/unicode.py @@ -0,0 +1,49 @@ +import codecs as c + +import discord +from redbot.core import commands + + +class Unicode: + """Encode/Decode Unicode characters!""" + + def __init__(self, bot): + self.bot = bot + + @commands.group(name='unicode', pass_context=True) + async def unicode(self, ctx): + """Encode/Decode a Unicode character.""" + if ctx.invoked_subcommand is None: + pass + + @unicode.command() + async def decode(self, ctx: commands.Context, character): + """Decode a Unicode character.""" + try: + data = 'U+{:04X}'.format(ord(character[0])) + color = discord.Color.green() + except ValueError: + data = '' + color = discord.Color.red() + em = discord.Embed(title=character, description=data, color=color) + await ctx.send(embed=em) + + @unicode.command() + async def encode(self, ctx:commands.Context, character): + """Encode an Unicode character.""" + try: + if character[:2] == '\\u': + data = repr(c.decode(character, 'unicode-escape')) + data = data.strip("'") + color = discord.Color.green() + elif character[:2] == 'U+': + data = chr(int(character.lstrip('U+'), 16)) + color = discord.Color.green() + else: + data = '' + color = discord.Color.red() + except ValueError: + data = '' + color = discord.Color.red() + em = discord.Embed(title=character, description=data, color=color) + await ctx.send(embed=em)