Skip to content

Instantly share code, notes, and snippets.

View Zzz9194's full-sized avatar
💭
Good Ol' County Roaadssss

Zzz9194

💭
Good Ol' County Roaadssss
View GitHub Profile
import discord
def ask(
bot: discord.ext.commands.Bot,
ctx: discord.ext.commands.Context,
question: str,
timeout: float = 30.0,
target_user: discord.Member = None,
target_location: Union[discord.TextChannel, discord.Member] = None,
@Zzz9194
Zzz9194 / selector_menu.py
Created August 17, 2020 13:36
Basic terminal selection menu for my own use
from pynput.keyboard import Listener, Key
import os
current: int = 1
select = None
options = [
"Start",
"Help",
"Exit"
]
@Zzz9194
Zzz9194 / rainbow_embed.md
Last active July 16, 2020 14:21
Make a command that sends a rainbow embed (Editing the embed w/ different colors at a certain interval for an amount of time)
from discord.ext import commands
from discord import Embed, Color

from random import randint as ri
from asyncio import sleep as sl

@bot.command(name="rainbow")
async def rainbow_cmd(ctx):
 emb = discord.Embed(title="Rainbow time 🕺")
@Zzz9194
Zzz9194 / discord_colors.md
Last active April 4, 2022 02:05
Guide to certain elements of discord.py people may be confused about

Get cool colors for your embeds!

discord.Color and discord.Colour are BOTH acceptable

Discord.py has a bunch of colors pre-stored as classmethods

import discord

# Maybe use a hex value??!!?!?!
import termcolor
import random
import os
import time
space_stuffs = {
"star": "✦",
"backtick": "`",
"dot": ".",
"comma": ",",
@Zzz9194
Zzz9194 / key_tracker.py
Created June 10, 2020 13:35
Tracks what has been typed on your keyboard w/ the pynput module.
# Requirements pynput module
from pynput.keyboard import Listener, Key
def on_press(key):
print(key + " was pressed")
with Listener(on_press=on_press) as listener:
listener.join()
@Zzz9194
Zzz9194 / database-update.py
Last active June 5, 2020 19:53
Gist to allow you to get updates on group demotions, promotions, removals and acceptances. By running `python3 database-update.py` when you wish for an update. You can run `python3 database-update.py view (rolename)` to view members of that role, or remove rolename to view all group members
# REQUIREMENTS -> data.json FILE
# REQUIREMENTS -> REQUESTS MODULE
# REQUIREMENTS -> JSON MODULE
# REQUIREMENTS -> SYS MODULE
# REQUIREMENTS (OPTIONAL) -> COLORAMA MODULE
# REQUIREMENT -> A ROBLOX GROUP ID
GROUP_IDENTIFIER_ID = #Insert integer group ID here
import requests
# Requirements
# - A DB
# - A venv w/ sqlalchemy & requests
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationships
import requests
import sys
import requests
import discord
from discord import Webhook, RequestsWebhookAdapter
def sendhook(url):
hookLink = requests.get(url).json()
hookId = hookLink['id']
hookToken = hookLink['token']
@Zzz9194
Zzz9194 / psa.py
Last active April 16, 2020 07:21
import requests
def psaCheck(uid) -> str:
# A list of all valid NHC group
allGroups = ['mayflower department of justice','new haven county transit authority','mayflower national guard','mayflower public broadcasting service','mayflower state legislature','mayflower parks and wildlife department','lander police department','mayflower state police','mayflower courts','plymouth police department','new haven county fire department','new haven county sherrifs office']
userGroups = getGroups(uid) # The dictionary of all a users' groups
counter = 0 # <- Keeps track of the number of violations
for group in list(userGroups.keys()):
# The keys are all the group names