parent
c3d1ad5026
commit
e1723f5779
@ -0,0 +1,5 @@
|
||||
from .lovecalculator import LoveCalculator
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(LoveCalculator(bot))
|
@ -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"
|
||||
]
|
||||
}
|
@ -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)
|
@ -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)
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
@ -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 LoveCalculator. Stary recycling today!",
|
||||
"requirements": [],
|
||||
"short": "ply for a job at the recycling plant!",
|
||||
"tags": [
|
||||
"bobloy",
|
||||
"environment",
|
||||
"games"
|
||||
]
|
||||
}
|
@ -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()
|
||||
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)))
|
Loading…
Reference in new issue