Skip to content

Instantly share code, notes, and snippets.

View NotSoSuper's full-sized avatar
🥓
test

NotSoSuper

🥓
test
View GitHub Profile

Keybase proof

I hereby claim:

  • I am NotSoSuper on github.
  • I am notsosuper (https://keybase.io/notsosuper) on keybase.
  • I have a public key whose fingerprint is 17EF 5190 761D 3C74 0C87 6527 C31C 4CFC 71DF 31A7

To claim this, I am signing this object:

@NotSoSuper
NotSoSuper / oauth.py
Last active October 15, 2016 17:05
you need your own token but whatever
oauth_regex = r"^https:\/\/discordapp\.com\/oauth2\/authorize\?client_id=(\d+)"
@commands.command(pass_context=True, aliases=['addbot'])
@commands.bot_has_permissions(manage_server=True)
async def oauth(self, ctx, url:str):
regex = re.compile(self.oauth_regex)
match = regex.findall(url)
if len(match) == 1:
client_id = match[0]
else:
await self.bot.say(":exclamation: Invalid OAUTH URL")
@NotSoSuper
NotSoSuper / help.lua
Last active October 25, 2023 16:04
NotSoBot Help Documentation
Complete command list of NotSoBot <439205512425504771>:
Owner: NotSoSuper <296044494812479498>
Prefix: .
* = Not Required
^ = Bot Owner Only
^^ = Server Admin Only
"/'s" in commands show aliases for the command (Ex: ".reverse/r <text>" Command can be run with .reverse or .r)
<max_messages> = The number of messages to search through
<image> = The image URL, @discord_user, the users name, discord/custom emoji, or, nothing inputted which will search through 25 messages for embeds or attachments
<image-face> = Image requires a HUMAN FACE to be included
retro_regex = re.compile(r"((https)(\:\/\/|)?u3\.photofunia\.com\/.\/results\/.\/.\/.*(\.jpg\?download))")
@commands.command()
async def retro(self, *, text:str):
if len(text) >= 15:
text = [text[i:i + 15] for i in range(0, len(text), 15)]
else:
split = text.split()
if len(split) == 1:
text = [x for x in text]
else:
@NotSoSuper
NotSoSuper / get_images.py
Last active July 23, 2021 01:05
Get Images/Gifs in Discord for commands.
image_mimes = ['image/png', 'image/pjpeg', 'image/jpeg', 'image/x-icon']
async def isimage(url:str):
try:
with aiohttp.ClientSession() as session:
with aiohttp.Timeout(30):
async with session.get(url) as resp:
if resp.status == 200:
mime = resp.headers.get('Content-type', '').lower()
if any([mime == x for x in image_mimes]):
return True
@NotSoSuper
NotSoSuper / react.py
Created November 5, 2016 01:16
react command
@commands.command(pass_context=True)
@commands.cooldown(1, 5)
async def react(self, ctx, *, txt:str):
msg = None
for s in txt.split():
if s.isdigit():
if len(s) > 10:
msg = await self.bot.get_message(ctx.message.channel, s)
txt = txt.replace(s, '')
break
@NotSoSuper
NotSoSuper / funcs.py
Created December 1, 2016 20:22
some utility functions for discord bots
import asyncio
import discord
import aiohttp
import re
import aiohttp
import random
import sys
import os
import aiosocks
import time
from lxml import etree
#http://stackoverflow.com/a/34084933
def get_deep_text(element):
try:
text = element.text or ''
for subelement in element:
text += get_deep_text(subelement)
text += element.tail or ''
return text
def do_gmagik(self, ctx, gif):
try:
try:
gif = PIL.Image.open(gif)
except:
return '\N{WARNING SIGN} Invalid Gif.'
if gif.size >= (3000, 3000):
return '\N{WARNING SIGN} `GIF resolution exceeds maximum >= (3000, 3000).`'
elif gif.n_frames > 150 and ctx.message.author.id != self.bot.owner.id:
return "\N{WARNING SIGN} `GIF has too many frames (> 150 Frames).`"
import os
cows = os.listdir('/usr/share/cowsay/cows')
base = r"""
@commands.command(aliases=['{0}'])
async def {1}say(self, *, txt:str):
msg = await self.do_cowsay(txt, '{0}')
await self.bot.say("```\n"+msg[:1992]+"```")
"""