Skip to content

Instantly share code, notes, and snippets.

View jb3's full-sized avatar
😁
#OpenErlang

Joe Banks jb3

😁
#OpenErlang
View GitHub Profile
@jb3
jb3 / detect.py
Last active April 26, 2022 22:31
Crash file detector for Discord
import asyncio
import sys
import pprint
loop = asyncio.get_event_loop()
# List of files to check
FILES = [
"/Users/joseph/Movies/coursework_update.mp4",
"/Users/joseph/Movies/coursework_video.mp4",
@jb3
jb3 / README.md
Last active September 25, 2024 14:34
A simple implementation of Discord Slash Commands in Python with Microsoft Function Apps.

Dice rolling — Discord Interaction Edition

This is a very basic Discord Interaction designed to run on Azure Function Apps using the Python runtime.

Steps to get running

  1. Head to Discord and create a new application, take note of the Client ID, Client Secret and Interactions Public Key.
  2. Create a new Azure function app with the code in azure_function.py, make sure to add an app setting called INTERACTION_PUBLIC_KEY with the value taken from Discord. Make sure to add discord_interactions to your requirements.txt file, the function depends on it!
  3. Place the URL of your App Function HTTP trigger into the Discord Developer portal. If things are working it will allow you to save.
  4. Add the application to your server by visiting the OAuth2 URL generator in the Developer portal and creating a link with the application.commands scope.
FROM elixir:latest AS app_builder
ENV MIX_ENV=prod \
TEST=1 \
LANG=C.UTF-8
RUN mix local.hex --force && \
mix local.rebar --force
RUN mkdir /app
@jb3
jb3 / keybase.md
Created September 10, 2020 17:39

Keybase proof

I hereby claim:

  • I am jb3 on github.
  • I am j03b (https://keybase.io/j03b) on keybase.
  • I have a public key ASCEynZa2DzuIsTjuDSnTBso-1yA7WuQi2zTtMBeMqcsugo

To claim this, I am signing this object:

@jb3
jb3 / phabricator.yaml
Last active August 12, 2020 20:01
Phabricator k8s deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: modcast-phabricator
spec:
revisionHistoryLimit: 2
replicas: 1
selector:
matchLabels:
app: modcast-phabricator
import asyncio
import aiodns
loop = asyncio.get_event_loop()
resolver = aiodns.DNSResolver(loop=loop)
async def lookup(tld, data):
try:
data[tld] = await resolver.query(tld, "A")
except:
@jb3
jb3 / modqueue_relay.py
Created July 14, 2020 22:57
Reddit report to Discord relay
import httpx
from praw import Reddit
from praw.models import Comment, Submission
from datetime import datetime
r = Reddit(
client_id="",
client_secret="",
password="",
user_agent="pythonmodqueuerelay by /u/Im__Joseph",
@jb3
jb3 / bot.py
Created July 6, 2020 10:27
Example of patching some Discord.py objects
from discord import Client
from patches import patch_discord_py
patch_discord_py()
client = Client()
@client.event
async def on_message(msg):
import urllib.parse
from typing import Union
import httpx
with open("./github.access") as token_file:
token = token_file.read().strip()
def get(route: str, arguments: dict = {}) -> Union[dict, list]:
return httpx.get(
from pypresence import Presence
import time
client_id = "503540314506657792"
rpc = Presence(client_id)
rpc.connect()
data = {
"large_image": "smiley",