This repository has been archived by the owner on Jan 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Benjamin O'Brien
committed
Oct 4, 2020
1 parent
0f22814
commit 7ccf2be
Showing
8 changed files
with
239 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Modules | ||
import base64 | ||
import discord | ||
|
||
from assets.prism import Tools | ||
from discord.ext import commands | ||
|
||
# Main Command Class | ||
class Decrypt(commands.Cog): | ||
|
||
def __init__(self, bot): | ||
self.bot = bot | ||
self.desc = "Decrypt some text using the base64 format." | ||
self.usage = "decrypt [text]" | ||
|
||
@commands.command() | ||
async def decrypt(self, ctx, *, text: str = None): | ||
|
||
if not text: | ||
|
||
return await ctx.send(embed = Tools.error("No text specified to decrypt.")) | ||
|
||
try: | ||
|
||
encrypted = base64.b64decode(text.encode("ascii")).decode("ascii") | ||
|
||
except: | ||
|
||
return await ctx.send(embed = Tools.error("Sorry, your text couldn't be decrypted.")) | ||
|
||
embed = discord.Embed(title = "Decryption Results", description = f"```\n{encrypted}\n```", color = 0x126bf1) | ||
|
||
embed.set_author(name = " | Decrypt", icon_url = self.bot.user.avatar_url) | ||
|
||
embed.set_footer(text = f" | Requested by {ctx.author}.", icon_url = ctx.author.avatar_url) | ||
|
||
try: | ||
|
||
return await ctx.send(embed = embed) | ||
|
||
except: | ||
|
||
return await ctx.send(embed = Tools.error("Failed to send the embed, check your text.")) | ||
|
||
# Link to bot | ||
def setup(bot): | ||
bot.add_cog(Decrypt(bot)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Modules | ||
import base64 | ||
import discord | ||
|
||
from assets.prism import Tools | ||
from discord.ext import commands | ||
|
||
# Main Command Class | ||
class Encrypt(commands.Cog): | ||
|
||
def __init__(self, bot): | ||
self.bot = bot | ||
self.desc = "Encrypts some text using the base64 format." | ||
self.usage = "encrypt [text]" | ||
|
||
@commands.command() | ||
async def encrypt(self, ctx, *, text: str = None): | ||
|
||
if not text: | ||
|
||
return await ctx.send(embed = Tools.error("No text specified to encrypt.")) | ||
|
||
elif len(text) > 200: | ||
|
||
return await ctx.send(embed = Tools.error("Text is too long, it should be 200 at max.")) | ||
|
||
try: | ||
|
||
encrypted = base64.b64encode(text.encode("ascii")).decode("ascii") | ||
|
||
except: | ||
|
||
return await ctx.send(embed = Tools.error("Sorry, your text couldn't be encrypted.")) | ||
|
||
embed = discord.Embed(title = "Encryption Results", description = f"```\n{encrypted}\n```", color = 0x126bf1) | ||
|
||
embed.set_author(name = " | Encrypt", icon_url = self.bot.user.avatar_url) | ||
|
||
embed.set_footer(text = f" | Requested by {ctx.author}.", icon_url = ctx.author.avatar_url) | ||
|
||
try: | ||
|
||
return await ctx.send(embed = embed) | ||
|
||
except: | ||
|
||
return await ctx.send(embed = Tools.error("Failed to send the embed, check your text.")) | ||
|
||
# Link to bot | ||
def setup(bot): | ||
bot.add_cog(Encrypt(bot)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Modules | ||
import discord | ||
from assets.prism import Tools | ||
|
||
from discord.ext import commands | ||
|
||
# Main Command Class | ||
class Join(commands.Cog): | ||
|
||
def __init__(self, bot): | ||
self.bot = bot | ||
self.desc = "Connects to your voice channel." | ||
self.usage = "join" | ||
|
||
@commands.command(aliases = ["connect"]) | ||
async def join(self, ctx): | ||
|
||
if not ctx.author.voice: | ||
|
||
return await ctx.send(embed = Tools.error("You aren't in a voice channel.")) | ||
|
||
voice = discord.utils.get(self.bot.voice_clients, guild = ctx.guild) | ||
|
||
if voice: | ||
|
||
await voice.move_to(ctx.author.voice.channel) | ||
|
||
return await ctx.send(embed = discord.Embed(description = f":wave: **Moved to #{ctx.author.voice.channel.name}.**", color = 0x126bf1)) | ||
|
||
else: | ||
|
||
await ctx.author.voice.channel.connect() | ||
|
||
return await ctx.send(embed = discord.Embed(description = f":wave: **Connected to #{ctx.author.voice.channel.name}.**", color = 0x126bf1)) | ||
|
||
# Link to bot | ||
def setup(bot): | ||
bot.add_cog(Join(bot)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Modules | ||
import discord | ||
from assets.prism import Tools | ||
|
||
from discord.ext import commands | ||
|
||
# Main Command Class | ||
class Leave(commands.Cog): | ||
|
||
def __init__(self, bot): | ||
self.bot = bot | ||
self.desc = "Makes Prism leave your voice channel." | ||
self.usage = "leave" | ||
|
||
@commands.command(aliases = ["disconnect", "dsc", "fuckoff"]) | ||
async def leave(self, ctx): | ||
|
||
if not ctx.author.voice: | ||
|
||
return await ctx.send(embed = Tools.error("You aren't in a voice channel.")) | ||
|
||
voice = discord.utils.get(self.bot.voice_clients, guild = ctx.guild) | ||
|
||
if not voice: | ||
|
||
return await ctx.send(embed = Tools.error("Prism isn't in a voice channel.")) | ||
|
||
elif voice.is_playing(): | ||
|
||
try: | ||
|
||
voice.stop() | ||
|
||
except: | ||
|
||
pass | ||
|
||
await voice.disconnect() | ||
|
||
return await ctx.send(embed = discord.Embed(description = f":wave: **Left the voice channel.**", color = 0x126bf1)) | ||
|
||
# Link to bot | ||
def setup(bot): | ||
bot.add_cog(Leave(bot)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Modules | ||
import discord | ||
|
||
from assets.prism import Tools | ||
from discord.ext import commands | ||
|
||
# Main Command Class | ||
class Stop(commands.Cog): | ||
|
||
def __init__(self, bot): | ||
self.bot = bot | ||
self.desc = "Stops playing music in your voice channel." | ||
self.usage = "stop" | ||
|
||
@commands.command() | ||
async def stop(self, ctx): | ||
|
||
if not ctx.author.voice: | ||
|
||
return await ctx.send(embed = Tools.error("You aren't in a voice channel.")) | ||
|
||
voice = discord.utils.get(self.bot.voice_clients, guild = ctx.guild) | ||
|
||
if not voice: | ||
|
||
return await ctx.send(embed = Tools.error("Prism isn't in a voice channel.")) | ||
|
||
elif not voice.is_playing(): | ||
|
||
return await ctx.send(embed = Tools.error("No music is currently playing.")) | ||
|
||
try: | ||
|
||
voice.stop() | ||
|
||
except: | ||
|
||
return await ctx.send(embed = Tools.error("Something went wrong while stopping.")) | ||
|
||
return await ctx.send(embed = discord.Embed(description = f":x: **Playback stopped.**", color = 0x126bf1)) | ||
|
||
# Link to bot | ||
def setup(bot): | ||
bot.add_cog(Stop(bot)) |