Skip to content

Instantly share code, notes, and snippets.

@imptype
imptype / alt-test.py
Last active April 18, 2024 23:01
Compress text to Unicode text for Discord Custom IDs.
# alternative to convert number strings to printable ascii, for smaller deta base strings, ' ' space reserved
ascii_chars = list(r'''!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~''')
def power_sum(values, base, offset = 0):
return sum(value * base ** (index + offset) for index, value in enumerate(values))
def convert_text(text, chars):
base = len(chars) + 1
chars = {char : index + 1 for index, char in enumerate(chars)}
temp = []
@imptype
imptype / edited.txt
Last active September 25, 2023 18:44
Printable ascii characters sorted by frequency
etaonisrhldcumfpgyw,.bv01k52TS9AM-CIN"438B6RPEDHx7WLOFYGJzjUq:)($K;V*?Q/X&Z!%#@`'+<=>[\]^_{|}~
@imptype
imptype / main.py
Created March 31, 2023 16:30
ChatGPT Discord Bot
import os
import openai
import discord
openai.api_key = os.getenv('OPENAI_API_KEY')
client = discord.Client(intents = discord.Intents(messages = True, message_content = True))
client.processing = 0
@client.event
async def on_ready():
@imptype
imptype / messagemaker.py
Last active October 1, 2024 01:20
A better embed maker/embed builder for discord.py
"""
The messagemaker command!
Supports:
- Editing message content
- Add, edit, remove, clear embeds: title, desc, timestamp, fields etc. - everything to customize an embed.
-- Exporting and Importing exclusively for the embed
- Importing JSON: from modal text input, from mystbin link, from existing message
- Exporting to JSON, as a message or uploaded as file and mystbin link if < 2000 chars
- Sending to: a channel, a webhook, edit existing message
@imptype
imptype / embedmaker.py
Last active May 2, 2024 19:25
embed maker command
"""
A quick embed maker command.
Supports Title, URL, Description, Color, Timestamp,
Author (name, icon, url), Footer (icon, name), Image (url), Thumbnail (url)
adding and inserting fields (name, value, inline, index),
removing fields (index),
clearing fields,
editing fields (select -> name, value, inline)