diff --git a/lynxie/commands/e621.py b/lynxie/commands/e621.py new file mode 100644 index 0000000..3be171d --- /dev/null +++ b/lynxie/commands/e621.py @@ -0,0 +1,35 @@ +from selenium import webdriver +from bs4 import BeautifulSoup +import discord +from discord.ext import commands + + +class E621(commands.Cog): + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def e621(self, ctx): + embed = discord.Embed( + title='Search Results', + description='Here\'s a list of jobs I found on Indeed, just for you!', + colour=discord.Colour.orange(), + ) + + browser = webdriver.Firefox() + browser.get("https://www.indeed.com/jobs?q=cleaner&l=New%20York") + soup = BeautifulSoup(browser.page_source, "html.parser") + browser.close() + + for job in soup.find_all("div", {"class": "job_seen_beacon"}): + job_title = job.find("h2", {"class": "jobTitle"}).find("span").text.strip() or "Job Title" + company_name = job.find("span", {"class": "companyName"}).text.strip() or "Company Name" + company_location = job.find("div", {"class": "companyLocation"}).text.strip() or "Location" + + embed.add_field( + name=job_title, + value=f'{company_name} - {company_location}', + inline=False, + ) + + await ctx.send(embed=embed) diff --git a/lynxie/commands/help.py b/lynxie/commands/help.py new file mode 100644 index 0000000..15905c3 --- /dev/null +++ b/lynxie/commands/help.py @@ -0,0 +1,33 @@ +import discord +from discord.ext import commands + + +class Help(commands.Cog): + def __init__(self, bot): + self.bot = bot + self.help_commands = { + "help": "Show this message", + "ping": "Pong!", + "hello": "Say hello to Lynxie!", + "join": "Join the voice channel you're in", + "play ": "Play a song from YouTube, SoundCloud, etc.", + "stop": "Stop the current song and leave the voice channel", + "e621": "Search e621.net", + } + + @commands.command() + async def help(self, ctx): + embed = discord.Embed( + title='Help', + description='Lynxie\'s prefix is `AAAA `', + colour=discord.Colour.orange(), + ) + + for command, description in self.help_commands.items(): + embed.add_field( + name=command, + value=description, + inline=False, + ) + + await ctx.send(embed=embed) diff --git a/lynxie/commands/ping.py b/lynxie/commands/ping.py new file mode 100644 index 0000000..f2ce7ca --- /dev/null +++ b/lynxie/commands/ping.py @@ -0,0 +1,10 @@ +from discord.ext import commands + + +class Ping(commands.Cog): + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def ping(self, ctx): + await ctx.send(f"Pong! {round(self.bot.latency * 1000)}ms")