mirror of
https://github.com/Fluffy-Bean/Lynxie.git
synced 2025-05-28 22:33:14 +00:00
Clean up code
This commit is contained in:
parent
90a347eb0b
commit
c359356f4b
10 changed files with 51 additions and 36 deletions
12
lynxie/commands/e621.py
Normal file
12
lynxie/commands/e621.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
import requests
|
||||
|
||||
from discord.ext import commands
|
||||
|
||||
|
||||
class E621(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.command()
|
||||
async def e621(self, ctx):
|
||||
await ctx.reply(f":3")
|
|
@ -1,3 +1,4 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
|
||||
|
@ -7,4 +8,10 @@ class Hello(commands.Cog):
|
|||
|
||||
@commands.command()
|
||||
async def hello(self, ctx):
|
||||
await ctx.send(f"Hello from England, {ctx.author.mention}!")
|
||||
embed = discord.Embed(
|
||||
title="Hello!",
|
||||
description="I'm Lynxie, a multipurpose Discord bot written in Python!",
|
||||
color=discord.Color.orange(),
|
||||
)
|
||||
|
||||
await ctx.reply(embed=embed)
|
||||
|
|
|
@ -14,7 +14,8 @@ class Help(commands.Cog):
|
|||
"play <url>": "Play a song from YouTube, SoundCloud, etc.",
|
||||
"stop": "Stop the current song and leave the voice channel",
|
||||
"animal <animal>": "Get a random image of an animal!",
|
||||
"overlay <style>": "Overlay an image with a style, e.g. `bubble`",
|
||||
"overlay <image> <style>": "Overlay an image with a style, e.g. `bubble mask`",
|
||||
"saveable": "Turn image into a GIF to save within Discord",
|
||||
}
|
||||
|
||||
@commands.command()
|
||||
|
|
|
@ -86,7 +86,7 @@ class Img(commands.Cog):
|
|||
|
||||
width, height = image_attachments.width, image_attachments.height
|
||||
if not 10 < width <= 4500 or not 10 < height <= 4500:
|
||||
error = "Image must be at least 10x10 and under 4500x4500!"
|
||||
error = "Image must be at least over 10x10 and under 4500x4500!"
|
||||
await ctx.reply(embed=error_message(error))
|
||||
return
|
||||
|
||||
|
|
|
@ -24,20 +24,24 @@ class Music(commands.Cog):
|
|||
async with ctx.typing():
|
||||
try:
|
||||
song_info = ytdl.extract_info(url, download=False)
|
||||
print(song_info["url"])
|
||||
ctx.voice_client.play(
|
||||
discord.FFmpegPCMAudio(song_info["url"], **ffmpeg_options)
|
||||
)
|
||||
except Exception:
|
||||
except Exception as err:
|
||||
error = "An error occurred while processing this request." + str(err)
|
||||
await ctx.reply(
|
||||
embed=error_message(
|
||||
"An error occurred while processing this request."
|
||||
),
|
||||
embed=error_message(error),
|
||||
mention_author=False,
|
||||
)
|
||||
return
|
||||
|
||||
await ctx.send(f"Now playing: {song_info['title']}")
|
||||
embed = discord.Embed(
|
||||
title="Now playing",
|
||||
description=f"[{song_info['title']}]({song_info['webpage_url']})",
|
||||
color=discord.Color.orange(),
|
||||
)
|
||||
|
||||
await ctx.reply(embed=embed, mention_author=False)
|
||||
|
||||
@commands.command()
|
||||
async def stop(self, ctx):
|
||||
|
@ -49,9 +53,11 @@ class Music(commands.Cog):
|
|||
if ctx.author.voice:
|
||||
await ctx.author.voice.channel.connect()
|
||||
else:
|
||||
error = "You are not connected to a voice channel."
|
||||
await ctx.reply(
|
||||
embed=error_message("You are not connected to a voice channel!"),
|
||||
embed=error_message(error),
|
||||
mention_author=False,
|
||||
)
|
||||
return
|
||||
elif ctx.voice_client.is_playing():
|
||||
ctx.voice_client.stop()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
|
||||
|
@ -7,4 +8,9 @@ class Ping(commands.Cog):
|
|||
|
||||
@commands.command()
|
||||
async def ping(self, ctx):
|
||||
await ctx.send(f"Pong! {round(self.bot.latency * 1000)}ms")
|
||||
embed = discord.Embed(
|
||||
title="Pong!",
|
||||
description=f"{round(self.bot.latency * 1000)}ms",
|
||||
color=discord.Color.orange(),
|
||||
)
|
||||
await ctx.reply(embed=embed, mention_author=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue