Testing/CI #21
+12
-8
@@ -108,6 +108,16 @@ class Shitpost(commands.Cog):
|
|||||||
|
|
||||||
yield from ctx.channel.send(ctx.author.mention + ' ' + str(Message))
|
yield from ctx.channel.send(ctx.author.mention + ' ' + str(Message))
|
||||||
|
|
||||||
|
def zalgofy(self, sentence, factor = 4):
|
||||||
|
random.seed(datetime.now().timestamp())
|
||||||
|
message = ''
|
||||||
|
#from https://github.com/Aethylia/zalgo-cli:
|
||||||
|
for letter in sentence:
|
||||||
|
for i in range(factor):
|
||||||
|
letter += random.randint(0x300, 0x36f).to_bytes(2, byteorder='big').decode('utf-16be')
|
||||||
|
message += letter
|
||||||
|
return message
|
||||||
|
|
||||||
@commands.command(pass_context=True, hidden=False)
|
@commands.command(pass_context=True, hidden=False)
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def zalgo(self, ctx, *, arg):
|
def zalgo(self, ctx, *, arg):
|
||||||
@@ -118,18 +128,12 @@ class Shitpost(commands.Cog):
|
|||||||
Gebruik: !zalgo [text]
|
Gebruik: !zalgo [text]
|
||||||
Bijv: !zalgo "Je moeder"
|
Bijv: !zalgo "Je moeder"
|
||||||
"""
|
"""
|
||||||
factor = 4
|
message = self.zalgofy(arg)
|
||||||
message = ''
|
|
||||||
#from https://github.com/Aethylia/zalgo-cli:
|
|
||||||
for letter in arg:
|
|
||||||
for i in range(factor):
|
|
||||||
letter += random.randint(0x300, 0x36f).to_bytes(2, byteorder='big').decode('utf-16be')
|
|
||||||
message += letter
|
|
||||||
try:
|
try:
|
||||||
yield from ctx.message.delete()
|
yield from ctx.message.delete()
|
||||||
except:
|
except:
|
||||||
print("No permission to delete message")
|
print("No permission to delete message")
|
||||||
yield from ctx.channel.send(ctx.author.mention + ' ' + str(message))
|
yield from ctx.channel.send(str(message))
|
||||||
|
|
||||||
def get_corona_message(self):
|
def get_corona_message(self):
|
||||||
response = requests.get('https://covid.ourworldindata.org/data/latest/owid-covid-latest.json')
|
response = requests.get('https://covid.ourworldindata.org/data/latest/owid-covid-latest.json')
|
||||||
|
|||||||
@@ -163,3 +163,9 @@ class TestShitpost(unittest.TestCase):
|
|||||||
def test_corona(self):
|
def test_corona(self):
|
||||||
message = self.cog.get_corona_message()
|
message = self.cog.get_corona_message()
|
||||||
self.assertIsInstance(message, str)
|
self.assertIsInstance(message, str)
|
||||||
|
|
||||||
|
def test_zalgo(self):
|
||||||
|
inmsg = "lorem ipsum"
|
||||||
|
message = self.cog.zalgofy(inmsg)
|
||||||
|
self.assertIsInstance(message, str)
|
||||||
|
self.assertEqual(len(message), len(inmsg)*5)
|
||||||
|
|||||||
Reference in New Issue
Block a user