Skip to content

Instantly share code, notes, and snippets.

@Vexs
Vexs / quickpoll.py
Created July 4, 2017 21:08
Simple polling function for a discord.py discord bot
import discord
from discord.ext import commands
class QuickPoll:
""""""
def __init__(self, bot):
self.bot = bot
@Vexs
Vexs / AvatarLogger.py
Created July 12, 2017 02:34
An caching avatar logger for discord.py
import discord
from discord.ext import commands
import aiohttp
from PIL import Image
import io
import asyncio
from itertools import zip_longest
async def build_avatar_cache(self):
@Vexs
Vexs / AvatarLogger.py
Created July 12, 2017 03:42
Simple discord.py caching avatar logger.
import discord
from discord.ext import commands
import aiohttp
from PIL import Image
import io
import asyncio
from itertools import zip_longest
from pathlib import Path
import os
import discord
import json
import aiohttp
import asyncio
client = discord.Client()
user = 'CLEVERBOT.IO API USER'
key = 'CLEVERBOT.IO API KEY'
client.session = aiohttp.ClientSession()
import discord
import aiohttp
import re
def nexus_json_to_embed(json_data, game_name):
title = json_data.get('name', '')[:256]
# replace html escapes with ascii values. ex- &#34 turns into quotes
description = re.sub(r'&#(\d{2});', lambda x: chr(int(x.group(1))), json_data.get('summary', '')[:1024])
url = json_data.get('mod_page_uri', '')
from discord.ext import commands
from PIL import Image, ImageDraw, ImageFont
import aiohttp
import io
import re
@commands.command(pass_context=True)
async def angry(self, ctx, *, string='missing\n arguments'):
@Vexs
Vexs / async_error_handler.py
Last active May 13, 2021 03:17
Simple Error Handling ext.commands - for the async branch of discord.py. Backport of https://gist.github.com/EvieePy/7822af90858ef65012ea500bcecf1612
import traceback
import sys
from discord.ext import commands
import discord
class CommandErrorHandler:
def __init__(self, bot):
self.bot = bot
@Vexs
Vexs / muteCog.py
Last active June 8, 2018 05:06
Basic mute
import discord
import asyncio
import re
from discord.ext import commands
import sys
import traceback
time_regex = re.compile("(?:(\d{1,5})(h|s|m|d))+?")
time_dict = {"h":3600, "s":1, "m":60, "d":86400}
@Vexs
Vexs / emoji_map.json
Last active January 31, 2024 10:46
Discord emoji mapping. This is a JSON file! Please load it with json. Attempting to copy-paste it directly into python will not work! For diversity, see: https://gist.github.com/Vexs/9e4c14d41161590ca94d0d21e456fef0
{
"grinning": "\ud83d\ude00",
"smiley": "\ud83d\ude03",
"smile": "\ud83d\ude04",
"grin": "\ud83d\ude01",
"laughing": "\ud83d\ude06",
"satisfied": "\ud83d\ude06",
"face_holding_back_tears": "\ud83e\udd79",
"sweat_smile": "\ud83d\ude05",
"joy": "\ud83d\ude02",
@Vexs
Vexs / bot_example.py
Last active August 21, 2022 13:28 — forked from EvieePy/bot_example.py
A Cogs Example for the rewrite version of - discord.py
import discord
from discord.ext import commands
import sys, traceback
"""This is a multi file example showcasing many features of the command extension and the use of cogs.
These are examples only and are not intended to be used as a fully functioning bot. Rather they should give you a basic
understanding and platform for creating your own bot.
These examples make use of Python 3.6.2 and the rewrite version on the lib.