Remaining updates

pull/21/head
bobloy 6 years ago
parent 1494e0e023
commit c27595bb84

@ -13,16 +13,16 @@ class SCP:
"""Look up SCP articles. """Look up SCP articles.
Warning: Some of them may be too creepy or gruesome. Warning: Some of them may be too creepy or gruesome.
Reminder: You must specify a number between 1 and 3999. Reminder: You must specify a number between 1 and 4999.
""" """
# Thanks Shigbeard and Redjumpman for helping me! # Thanks Shigbeard and Redjumpman for helping me!
if 0 < num <= 3999: if 0 < num <= 4999:
msg = "http://www.scp-wiki.net/scp-{:03}".format(num) msg = "http://www.scp-wiki.net/scp-{:03}".format(num)
c = discord.Color.green() c = discord.Color.green()
else: else:
msg = "You must specify a number between 1 and 3999." msg = "You must specify a number between 1 and 4999."
c = discord.Color.red() c = discord.Color.red()
if ctx.embed_requested(): if ctx.embed_requested():

@ -0,0 +1,5 @@
from .unicode import Unicode
def setup(bot):
bot.add_cog(Unicode(bot))

@ -1,11 +1,21 @@
{ {
"AUTHOR": "SnappyDragon", "author": [
"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", "Bobloy",
"NAME": "Unicode", "SnappyDragon"
"SHORT": "Encode/Decode Unicode characters!", ],
"DESCRIPTION": "Encode/Decode a Unicode character!", "bot_version": [
"TAGS": [ 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", "utility",
"utlities" "tools"
] ]
} }

@ -1,7 +1,7 @@
import codecs as c import codecs as c
import discord import discord
from discord.ext import commands from redbot.core import commands
class Unicode: class Unicode:
@ -11,13 +11,13 @@ class Unicode:
self.bot = bot self.bot = bot
@commands.group(name='unicode', pass_context=True) @commands.group(name='unicode', pass_context=True)
async def unicode(self, context): async def unicode(self, ctx):
"""Encode/Decode a Unicode character.""" """Encode/Decode a Unicode character."""
if context.invoked_subcommand is None: if ctx.invoked_subcommand is None:
await self.bot.send_cmd_help(context) pass
@unicode.command() @unicode.command()
async def decode(self, character): async def decode(self, ctx: commands.Context, character):
"""Decode a Unicode character.""" """Decode a Unicode character."""
try: try:
data = 'U+{:04X}'.format(ord(character[0])) data = 'U+{:04X}'.format(ord(character[0]))
@ -26,10 +26,10 @@ class Unicode:
data = '<unknown>' data = '<unknown>'
color = discord.Color.red() color = discord.Color.red()
em = discord.Embed(title=character, description=data, color=color) em = discord.Embed(title=character, description=data, color=color)
await self.bot.say(embed=em) await ctx.send(embed=em)
@unicode.command() @unicode.command()
async def encode(self, character): async def encode(self, ctx:commands.Context, character):
"""Encode an Unicode character.""" """Encode an Unicode character."""
try: try:
if character[:2] == '\\u': if character[:2] == '\\u':
@ -46,8 +46,4 @@ class Unicode:
data = '<unknown>' data = '<unknown>'
color = discord.Color.red() color = discord.Color.red()
em = discord.Embed(title=character, description=data, color=color) em = discord.Embed(title=character, description=data, color=color)
await self.bot.say(embed=em) await ctx.send(embed=em)
def setup(bot):
bot.add_cog(Unicode(bot))

Loading…
Cancel
Save