Skip to content

Instantly share code, notes, and snippets.

from src import ModuleManager, utils
class Module(ModuleManager.BaseModule):
@utils.hook("api.post.hashbang-argocd")
def webhook(self, event):
server = self.bot.get_server_by_alias("hashbang")
if server and "#!" in server.channels:
channel = server.channels.get("#!")
data = event["data"].decode("utf8")
@jesopo
jesopo / extban.md
Last active January 24, 2020 11:58

ingredients

  • optional prefix ("$")
  • optional negation ("~")
  • char denoting meaning ("a")
  • separator character (":")

chary

$,~,a,:

insp

@jesopo
jesopo / isupport_listmodes.md
Last active January 23, 2020 17:26
ISUPPORT `LISTMODES` token proposal

ISUPPORT LISTMODES token

rationale

servers currently do not convey which RPL_*LIST and RPL_ENDOF*LIST numerics are used for custom list modes (e.g. +eIq.)

however, well established "custom" list modes can be roughly figured out doing the following:

+q

@jesopo
jesopo / quiet.md
Last active January 22, 2020 10:34
ISUPPORT `QUIET` token proposal

ISUPPORT QUIET token proposal

rationale

clients and bots are unable to detect a given IRCd's method of quieting/muting users. exposing instructions on how to apply and list these will be of great benefit for making quiets easier for those not overinformed about IRC's technical details.

this will also trivialise applying and selectively removing quiets for channel service bots; they can apply and remove specific quiets and can list all active quiets.

technicals

@jesopo
jesopo / account-id.md
Last active January 20, 2020 22:01
draft/account-id IRCv3 proposal

account-id proposal

rationale

bots, like BitBot, track user accounts (through WHOX, extended-join, account-notify) to grant permissions to users without them having to register/identify directly with BitBot.

This works well most of the time but there's two problematic situations;

  1. a user changes the name of their account and loses their permissions
  2. a user changes the name of their account or drops their account, someone else comes along and registers the same nickname and is granted the permissions that user had
@jesopo
jesopo / editmsg.md
Last active September 28, 2021 23:37
draft/edit and draft/delete IRCv3 message-tag proposal

editmsg proposal

Rationale

firstly, almost every other chat platform supports editable/deletable messages as a user convenience - a convenience that people grow to expect.

secondly, moderation often needs ability to edit or delete messages (think NSFW urls)

Technical details and examples

this spec provides a draft/editmsg CAP as the fallback functionality requires server intervention.

@jesopo
jesopo / ap.sh
Last active November 14, 2019 16:40
Bash script for requesting and pretty-printing ActivityPub URLs. Requires https://stedolan.github.io/jq/
#!/bin/bash
CONTENT_FILE=`mktemp`
# write headers directly to stdout ("-D-")
# write content to temp file to later pass through |jq ("-o $CONTENT_FILE")
curl -D- -s -H "Accept: application/activity+json" "$1" -o $CONTENT_FILE
cat $CONTENT_FILE | jq
rm $CONTENT_FILE
@jesopo
jesopo / git-clone.py
Last active September 19, 2019 10:18
Testing raw git HTTP protocol with python3 and Requests
#!/usr/bin/env python3
# $ chmod +x git-clone.py
# $ ./git-clone.py https://github.com/jesopo/bitbot.git
import sys
import requests
repo = sys.argv[1]
@jesopo
jesopo / multiline.md
Last active September 5, 2019 16:44
bitbot.dev/multiline IRCv3 CAP outline

bitbot.dev/multiline

rationale

Simple: people want to either paste multi-line things (e.g. code) or say things that either cover multiple lines or extend past the ~512 byte cap. this spec is designed to solve all 3.

Technicals

CAP

bitbot.dev/multiline

@jesopo
jesopo / bitbot-ttmsh.py
Last active December 29, 2019 17:16
ttm.sh URL shortener for BitBot
from src import ModuleManager, utils
URL = "https://ttm.sh"
class Module(ModuleManager.BaseModule):
def on_load(self):
self.exports.add("shorturl-s-ttmsh", self._shorturl)
def _shorturl(self, url):
if len(url) < 18:
return None