Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Vexs
Vexs / emoji_map_diversity.json
Last active November 14, 2023 10:48
Discord emoji mapping, now with diversity!
{
"grinning": {
"emoji": "\ud83d\ude00"
},
"smiley": {
"emoji": "\ud83d\ude03"
},
"smile": {
"emoji": "\ud83d\ude04"
},
@Vexs
Vexs / example_cog.py
Created May 27, 2019 06:43
Short cog example
from discord.ext import commands
#cogs must now subclass commands.Cog
class MyCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
#listeners now must have a decorator
@commands.Cog.listener()
async def on_message(self, message):
@Vexs
Vexs / emoji_regex.txt
Last active May 6, 2021 21:12
Python Discord Emoji Regex
(?:\U0001f1e6[\U0001f1e8-\U0001f1ec\U0001f1ee\U0001f1f1\U0001f1f2\U0001f1f4\U0001f1f6-\U0001f1fa\U0001f1fc\U0001f1fd\U0001f1ff])|(?:\U0001f1e7[\U0001f1e6\U0001f1e7\U0001f1e9-\U0001f1ef\U0001f1f1-\U0001f1f4\U0001f1f6-\U0001f1f9\U0001f1fb\U0001f1fc\U0001f1fe\U0001f1ff])|(?:\U0001f1e8[\U0001f1e6\U0001f1e8\U0001f1e9\U0001f1eb-\U0001f1ee\U0001f1f0-\U0001f1f5\U0001f1f7\U0001f1fa-\U0001f1ff])|(?:\U0001f1e9[\U0001f1ea\U0001f1ec\U0001f1ef\U0001f1f0\U0001f1f2\U0001f1f4\U0001f1ff])|(?:\U0001f1ea[\U0001f1e6\U0001f1e8\U0001f1ea\U0001f1ec\U0001f1ed\U0001f1f7-\U0001f1fa])|(?:\U0001f1eb[\U0001f1ee-\U0001f1f0\U0001f1f2\U0001f1f4\U0001f1f7])|(?:\U0001f1ec[\U0001f1e6\U0001f1e7\U0001f1e9-\U0001f1ee\U0001f1f1-\U0001f1f3\U0001f1f5-\U0001f1fa\U0001f1fc\U0001f1fe])|(?:\U0001f1ed[\U0001f1f0\U0001f1f2\U0001f1f3\U0001f1f7\U0001f1f9\U0001f1fa])|(?:\U0001f1ee[\U0001f1e8-\U0001f1ea\U0001f1f1-\U0001f1f4\U0001f1f6-\U0001f1f9])|(?:\U0001f1ef[\U0001f1ea\U0001f1f2\U0001f1f4\U0001f1f5])|(?:\U0001f1f0[\U0001f1ea\U0001f1ec-\U0001f1ee\U0001f1f2\U0
@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.
@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 / 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 / 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
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'):
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', '')