profile
viewpoint
TJ Horner tjhorner @twosense Brooklyn, NY tjtjtj.tj

go-telegram-bot-api/telegram-bot-api 2298

Golang bindings for the Telegram Bot API

jaredallard/minecraft-preempt 14

Automatically start your minecraft server when a user joins

Neodeck/cah-creator-old 2

The codebase for the old version of CAH Creator.

tjhorner/asciify 1

ASCII art library written in Go

tjhorner/asdnpadsnpoansdopasdn 1

a poorly written, but funny, script

Academus/donate 0

Donation page for Academus

oohwooh/slack-git-status 0

integration for slack that shows latest commit

push eventtjhorner/tjhorner

C. K. Tang

commit sha 3e0e8c21d8e906c3bb198f8060521b212d25deac

add lorem ipsum

view details

TJ Horner

commit sha 6b8aec2ca9976ce660425f4bad77a619f1f84859

Merge pull request #3 from cktang88/patch-1 add corporate lorem ipsum

view details

push time in 10 hours

PR merged tjhorner/tjhorner

add corporate lorem ipsum

this is fun :P

+8 -0

1 comment

1 changed file

cktang88

pr closed time in 10 hours

pull request commenttjhorner/tjhorner

add corporate lorem ipsum

it would be really funny if this legitimately helps me in getting a job in the future

cktang88

comment created time in 10 hours

push eventtjhorner/asciify

TJ Horner

commit sha c0133b965ccfe7f51b2c2b9f1380fd60d842add6

chore: fix readme, again

view details

push time in 2 days

push eventtjhorner/asciify

TJ Horner

commit sha d7e56fc3c66220742555bdee43e4f21a86a0af37

change dat line height

view details

push time in 2 days

push eventtjhorner/asciify

TJ Horner

commit sha 21027a918985952539d21525b566cdc6f9595dfb

lol oops

view details

push time in 2 days

push eventtjhorner/asciify

TJ Horner

commit sha 47ac9615578c2dc24a14a6c1b1781cbd3c6956b4

the readme is now accurate again

view details

push time in 2 days

push eventtjhorner/asciify

TJ Horner

commit sha 80e7a60785278fd73781ecc4570a698690eb73f4

eee

view details

push time in 2 days

create barnchtjhorner/asciify

branch : gh-pages

created branch time in 2 days

push eventtjhorner/asciify

TJ Horner

commit sha c2cf66a93070b025fd5b66162a77b531f083f8de

fix: closes #1 and adds some perf improvements

view details

push time in 2 days

issue closedtjhorner/asciify

It doesn't actually do the thing correctly

So it's actually calculating the luminance -> character conversion wrong. I initially wrote this method with an alpha value in mind, then I realized that didn't make any sense so I used luminance instead. But I forgot to change the calculation because I am dumb. It's actually treating dark values as light values and vice versa. So that needs to be fixed.

Also, when it does calculate the luminance, I tried to make it factor in the alpha value, but that didn't really work because, again, I am dumb. I guess I need to make a "brighten" method that takes the original color and brightens it by a factor of 1 - A, so if there's like a fully transparent area it will just treat that as a fully bright (e.g. white) area. More transparent = more bright.

closed time in 2 days

tjhorner

issue commenttjhorner/asciify

It doesn't actually do the thing correctly

wait a second, (color.Color).RGBA returns it alpha-premultiplied

bruh

tjhorner

comment created time in 2 days

issue openedtjhorner/asciify

It doesn't actually do the thing correctly

So it's actually calculating the brightness -> character conversion wrong. I initially wrote this method with an alpha value in mind, then I realized that didn't make any sense so I used luminance instead. But I forgot to change the calculation because I am dumb. It's actually treating dark values as light values and vice versa. So that needs to be fixed.

Also, when it does calculate the luminance, I tried to make it factor in the alpha value, but that didn't really work because, again, I am dumb. I guess I need to make a "brighten" method that takes the original color and brightens it by a factor of the alpha value, so if there's like a fully transparent area it will just treat that as a fully bright (e.g. white) area.

created time in 2 days

push eventtjhorner/asciify

TJ Horner

commit sha b22c5e72333ae36d6cc15919d837a307afc90a8f

chore: readme

view details

push time in 3 days

push eventtjhorner/asciify

TJ Horner

commit sha 90eadc208fab7dde108ffb0af224212dfa8ff8ee

fix: more descriptive error

view details

push time in 3 days

push eventtjhorner/asciify

TJ Horner

commit sha 43eb75dbacfb4679c79cb3903b6cb9abd66e7675

chore: clean up readme

view details

push time in 3 days

push eventtjhorner/asciify

TJ Horner

commit sha 00e500fa724ce19dd582baa4014e2e885b534304

feat: imagify

view details

push time in 3 days

push eventtjhorner/asciify

TJ Horner

commit sha af60bfd97f06ac893ff8255321e4fe23438e1730

chore: add doc link to readme

view details

push time in 3 days

push eventtjhorner/asciify

TJ Horner

commit sha 8c0f135340f04b7c03b790afc8238e84712616bd

chore: tweak readme

view details

push time in 3 days

create barnchtjhorner/asciify

branch : master

created branch time in 3 days

created repositorytjhorner/asciify

ASCII art library written in Go

created time in 3 days

startedtwostraws/VisualEffects

started time in 3 days

issue commentgo-telegram-bot-api/telegram-bot-api

ChatMember Title is missing.

@himynameisulpa The CustomTitle field is now available on ChatMember.

himynameisulpa

comment created time in 3 days

push eventgo-telegram-bot-api/telegram-bot-api

TJ Horner

commit sha 5ebb3edeffaa49f5bdf05e6f810d171714211628

feat: Add CustomTitle field to ChatMember

view details

TJ Horner

commit sha 15c95b8a841865bf5cb00292f227f410c01cf4a2

Merge pull request #364 from go-telegram-bot-api/chatmember-custom-title Add CustomTitle field to ChatMember

view details

push time in 3 days

issue closedgo-telegram-bot-api/telegram-bot-api

ChatMember Title is missing.

Hi, https://godoc.org/github.com/go-telegram-bot-api/telegram-bot-api#ChatMember I need to use the title attribute. the python library has it: https://python-telegram-bot.readthedocs.io/en/stable/telegram.chatmember.html#telegram.ChatMember I hope, i can use it soon.

closed time in 3 days

himynameisulpa

issue commentgo-telegram-bot-api/telegram-bot-api

ChatMember Title is missing.

Thanks for bringing this up. I created #364 to address this. You can use the chatmember-custom-title branch in the meantime.

himynameisulpa

comment created time in 4 days

create barnchgo-telegram-bot-api/telegram-bot-api

branch : chatmember-custom-title

created branch time in 4 days

issue closedgo-telegram-bot-api/telegram-bot-api

Is it possible to run this alongside an HTTP server?

Apologies if this is a little confusing, but let me try to explain what I'm trying to achieve.

I have a REST API that currently does some processing for a SaaS app. We want to use Telegram for notifications. I want to be able to set this up so that the bot server is listening for POST requests on say /notification and then pass that on to the bot, say using something like bot.NewMessage(chatId, messageBody)

Would something like that be possible with this library?

Thanks in advance.

closed time in 4 days

Snazzyham

issue commentgo-telegram-bot-api/telegram-bot-api

Is it possible to run this alongside an HTTP server?

Assuming this was resolved... closing. Let me know if you need any more help.

Snazzyham

comment created time in 4 days

pull request commentjaredallard/minecraft-preempt

Add auto-shutdown based on player count

Writing automated tests would be awesome. But would probably require lotsa mocks lol

tjhorner

comment created time in 6 days

push eventtjhorner/minecraft-preempt

TJ Horner

commit sha 5f302c0924d67645b491629c87aabe5eb0d4f0ff

fix: use that error

view details

push time in 6 days

PR opened jaredallard/minecraft-preempt

Add auto-shutdown based on player count

I have tested none of this. But the logic goes like this:

Every time the server is pinged...

  • If at least 1 player is online, playersLastSeenAt is set to the current time
  • If the duration between playersLastSeenAt and now (i.e., how long it has been since we last saw a player) is less than what is configured, do nothing
  • Else, shut down the instance

Test it and let me know if it works lol

+108 -4

0 comment

5 changed files

pr created time in 6 days

push eventtjhorner/minecraft-preempt

TJ Horner

commit sha 23c8154a4f1bb2a5ce78c5ec028c11a8f04c64d0

chore: oops I fix

view details

push time in 6 days

create barnchtjhorner/minecraft-preempt

branch : auto-shutdown

created branch time in 6 days

issue openedjaredallard/minecraft-preempt

Change config loading logic

Currently the config is loaded relative from where the binary is located, which may not necessarily be the current directory. It should be changed so that it is loaded relative to the user's current directory. It would also be nice to have a flag to indicate where the config is stored.

created time in 6 days

fork tjhorner/minecraft-preempt

Automatically start your minecraft server when a user joins

fork in 6 days

startedjaredallard/minecraft-preempt

started time in 6 days

startedmandatoryprogrammer/NorthKoreaDNSLeak

started time in 7 days

issue commentgo-telegram-bot-api/telegram-bot-api

Is it possible to run this alongside an HTTP server?

If I am understanding you correctly, you have some other source sending events to POST /notification, and you want the bot to send a message to a Telegram user in response? That is definitely possible. You could do something like this (I didn't test it, so treat it like pseudocode):

bot, _ := tgbotapi.NewBotAPI("YourBotToken")

http.HandleFunc("/notification", func(w http.ResponseWriter, r *http.Request) {
	// Parse the data, or whatever
	msg := tgbotapi.NewMessage(12345, "Message text")
	bot.Send(msg)

	w.WriteHeader(200)
})
Snazzyham

comment created time in 9 days

startedmicrosoft/companion-device-framework

started time in 11 days

pull request commenttjhorner/gndr

add blockchain

oh

Etherealflux

comment created time in 16 days

push eventgo-telegram-bot-api/telegram-bot-api

Dmitriy Kharchenko

commit sha 7629a37f7708fa9a24c55fd490114922d026bdb3

Added validation and error checking for incoming updates in ListenForWebhook

view details

Dmitriy Kharchenko

commit sha 20b57111fc7b1d362967c786b2052b4481e6cccb

Merge branch 'master' of https://github.com/go-telegram-bot-api/telegram-bot-api into wehook-validation

view details

Dmitriy Kharchenko

commit sha b6575a2934b018fc5109ac4b161cc52f51210436

Added stream processing of input JSON Co-authored-by: TJ Horner <me@tjhorner.com>

view details

TJ Horner

commit sha fb8759e91dfc6af21bd422f49040e4ff463381b4

Merge pull request #282 from dmitriy-kharchenko/master Added validation and error checking for incoming updates in ListenFor…

view details

push time in 16 days

PR merged go-telegram-bot-api/telegram-bot-api

Added validation and error checking for incoming updates in ListenFor…

if you open the URL of the webhook in the browser for example to debug... then your app will crash due to memory violation. These Changes fix it!:)

+31 -12

7 comments

3 changed files

dmitriy-kharchenko

pr closed time in 16 days

issue commentgo-telegram-bot-api/telegram-bot-api

Answering inline query with a sticker

Oh that is a very old version, last commit is from 2018. Versioning is kind of a mess right now; you might want to just reference master until it's all figured out.

yevhenshymotiuk

comment created time in 16 days

issue commentgo-telegram-bot-api/telegram-bot-api

Answering inline query with a sticker

It seems to be available in the current release:

https://github.com/go-telegram-bot-api/telegram-bot-api/blob/7a018ae8739bcd25eeb220a85c35bf1ad73e1da8/types.go#L756-L764

yevhenshymotiuk

comment created time in 16 days

push eventtjhorner/gndr

TJ Horner

commit sha acb92a60e129a35a2bd564bf32bf7ec9bd48c266

add git repo to the thing

view details

push time in 16 days

push eventtjhorner/gndr

TJ Horner

commit sha 731a5c45b8e84ee0ffa71c80a1d8f24ba972c47d

fix typo

view details

push time in 16 days

create barnchtjhorner/gndr

branch : master

created branch time in 16 days

created repositorytjhorner/gndr

created time in 16 days

pull request commentgo-telegram-bot-api/telegram-bot-api

Close update channel and cancel current request on shutdown

the first one is to drop support of go <= 1.12 (current is 14)

Since this library doesn't have any real versioning at the moment, this would be pretty undesirable since it has a high chance of breaking existing installs. @Syfaro what do you think?

AstolfoKawaii

comment created time in 16 days

pull request commentgo-telegram-bot-api/telegram-bot-api

Add update type selection

Agreeing with @Syfaro here; seems simpler (and easier to understand) to have constant strings rather than constant ints alongside a map to their string equivalents. I think using a switch for validation would be just fine here.

Oppen

comment created time in 16 days

Pull request review commentgo-telegram-bot-api/telegram-bot-api

Added validation and error checking for incoming updates in ListenFor…

 func (bot *BotAPI) ListenForWebhook(pattern string) UpdatesChannel { 	ch := make(chan Update, bot.Buffer)  	http.HandleFunc(pattern, func(w http.ResponseWriter, r *http.Request) {-		ch <- bot.HandleUpdate(w, r)+		update, err := bot.HandleUpdate(r)+		if err != nil {+			errMsg, _ := json.Marshal(map[string]string{"error": err.Error()})+			w.WriteHeader(http.StatusBadRequest)+			w.Header().Set("Content-Type", "application/json")+			_, _ = w.Write(errMsg)+			return+		}++		ch <- *update 	})  	return ch }  // HandleUpdate parses and returns update received via webhook-func (bot *BotAPI) HandleUpdate(res http.ResponseWriter, req *http.Request) Update {-  bytes, _ := ioutil.ReadAll(req.Body)-  req.Body.Close()+func (bot *BotAPI) HandleUpdate(r *http.Request) (*Update, error) {+	if r.Method != http.MethodPost {+		err := errors.New("wrong HTTP method required POST")+		return nil, err+	} -  var update Update-  json.Unmarshal(bytes, &update)+	payload, err := ioutil.ReadAll(r.Body)+	if err != nil {+		return nil, err+	}++	if err := r.Body.Close(); err != nil {+		return nil, err+	}++	var update Update+	err = json.Unmarshal(payload, &update)+	if err != nil {+		return nil, err+	}

While we are here, how about we use json.Decoder instead of json.Unmarshal? This way we don't need to load the entire body into memory first. Well, loading it into memory is essentially what Go does internally, but I think it is better to let the language worry about the implementation of decoding a JSON stream. (Plus, it has some other niceties like failing early if a token is not allowed as it's streamed in, closing the body stream for us, etc.)

Could do something like:

	var update Update
	err := json.NewDecoder(r.Body).Decode(&update)
	if err != nil {
		return nil, err
	}
dmitriy-kharchenko

comment created time in 17 days

push eventtjhorner/docker-redirector

TJ Horner

commit sha 37728c3287ce18a6cfd223089510c98c8eea6b97

Update README.md

view details

push time in 18 days

push eventtjhorner/schema.tl

SchemaBot

commit sha e067b8152824872a7e0b1750c52748876ea10af7

[chore] Update to layer 116 (#37)

view details

push time in 18 days

delete branch tjhorner/schema.tl

delete branch : layer-116

delete time in 18 days

PR merged tjhorner/schema.tl

chore: Update to layer 116 layer update

Hello! It's time... time to update the schema layer! This pull request migrates from layer 114 to layer 116. Please check to make sure I didn't screw anything up!

New constructors

  • updateChannelParticipant
  • chatInvitePeek
  • statsGroupTopAdmin
  • statsGroupTopPoster
  • statsGroupTopInviter
  • stats.megagroupStats
  • globalPrivacySettings

New methods

  • account.getGlobalPrivacySettings
  • account.setGlobalPrivacySettings
  • help.dismissSuggestion
  • stats.getMegagroupStats

Documentation files were created for these new constructors and methods.

With ❤️, Your Friendly Neighborhood Schemabot

+680 -229

0 comment

15 changed files

SchemaBot

pr closed time in 18 days

startedgo-telegram-bot-api/telegram-bot-api

started time in 18 days

create barnchtjhorner/schema.tl

branch : layer-116

created branch time in 19 days

pull request commentsrnd/engage-a-tron

Bump discord.py to 1.3.4

JAKE I WAS ABOUT TO M ERGE IT

oohwooh

comment created time in 20 days

create barnchtjhorner/vrhr-server

branch : old-but-working

created branch time in a month

startedXe/site

started time in a month

pull request commentPaperMC/Parchment

Include MD5 hash for builds

@electronicboy Just wondering if you'd be happy with the change described above. If so, I'll implement it that way so we can get this PR merged.

tjhorner

comment created time in a month

push eventtjhorner/textscreen

TJ Horner

commit sha 3021d97f412c9c9b19e7df09e719ca0da710c6f0

MIT license

view details

push time in a month

push eventtjhorner/portal-sounds-bot

TJ Horner

commit sha 068b4dba575c0ee9b2a07cdf029e9c36ce275459

o

view details

push time in a month

push eventtjhorner/portal-sounds-bot

TJ Horner

commit sha 4d40d1e27ab845320f266a15bb9ba8856c8fa9af

haven't tested lol

view details

push time in a month

push eventtjhorner/tjhorner.github.io

TJ Horner

commit sha a7c6daed7104bc238172b7c50dc7bfe7440ddd2f

lol oops

view details

push time in a month

push eventtjhorner/tjhorner.github.io

TJ Horner

commit sha 054e080d6d5ab7a7435a6dd7ea40de05ef14b324

cool thinG

view details

TJ Horner

commit sha 08005f0f4db6b08faaad73b5a8e465a3d3ca2336

Merge branch 'master' of github.com:tjhorner/tjhorner.github.io

view details

push time in a month

push eventtjhorner/textscreen

TJ Horner

commit sha 6fcc580cfbbe9e0faf455656c04d48b88dbb0943

forward initial messageG

view details

push time in a month

push eventtjhorner/textscreen

TJ Horner

commit sha 378f85db1e6fa7abe410074e45257ceba6f75866

AAAAA

view details

push time in a month

push eventtjhorner/textscreen

TJ Horner

commit sha 222edfcda30acd98f8b2554edb8c784ba1f15850

god ok

view details

push time in a month

create barnchtjhorner/TextScreen

branch : master

created branch time in a month

created repositorytjhorner/TextScreen

created time in a month

PR merged tjhorner/tjhorner

Update README.md

beating captchas with gotchas

+4 -0

0 comment

1 changed file

eahrend

pr closed time in a month

push eventtjhorner/tjhorner

Erik Ahrend

commit sha e5a2a81a46ebce4337d6674ba33b603f4743bd42

Update README.md beating captchas with gotchas

view details

TJ Horner

commit sha ebb50b237d8c07e8a0d914fdfab64927090cf988

Merge pull request #2 from eahrend/patch-1 Update README.md

view details

push time in a month

pull request commenttjhorner/tjhorner

Edit name

begrudgingly merged

plusreed

comment created time in a month

push eventtjhorner/tjhorner

Reed

commit sha 6b06e13b099f458481a324e20b8fb0357745592d

Update README.md

view details

Reed

commit sha 4c6e18cfdc3aed230d9ed548f366f2680a15af4a

Actually follow the rules and not be stupid

view details

TJ Horner

commit sha 55628d48d4343357b6b665fb3789f3d2f7980bdd

Merge pull request #1 from plusreed/master awful

view details

push time in a month

PR merged tjhorner/tjhorner

Edit name

Name was not added to README so I added it ❤️

+2 -0

3 comments

1 changed file

plusreed

pr closed time in a month

pull request commenttjhorner/tjhorner

Edit name

actually it does violate rule 2, please move your content

plusreed

comment created time in a month

pull request commenttjhorner/tjhorner

Edit name

violates rule 3, it is very vulgar

plusreed

comment created time in a month

push eventtjhorner/tjhorner

TJ Horner

commit sha a2151148cb42ea842c8651713c0c18e82246f8b2

Update README.md

view details

push time in a month

created repositorytjhorner/tjhorner

d

created time in a month

create barnchtjhorner/tjhorner

branch : master

created branch time in a month

created repositorytjhorner/tjhorner

created time in a month

pull request commentzwagoth/e621ng

Return avatar ID in user API response

Oh awesome, thanks!

FurryEli

comment created time in a month

pull request commentPaperMC/Parchment

Include MD5 hash for builds

Sure, what about:

{
  "hashes": {
    "md5": "...",
    "sha256": "..."
  }
}

Just in case more algos are added later on. I was also considering adding a query-string parameter to specify which algorithm you wanted to use, so it wouldn't need to compute them all at once or needlessly increase response size. What do you think?

tjhorner

comment created time in a month

PR opened PaperMC/Parchment

Include MD5 hash for builds

Resolves #5

My friend kept asking me to +1 issues related to this so I decided to make a pull request so he would stop bugging me.

Also, as an unrelated side note, it doesn't look like it ever actually reads from the cache. For example:

https://github.com/PaperMC/Parchment/blob/3dc9af6f679e2d87b40dc1849c0d8575fb33747d/src/V1/BuildCacheTrait.php#L38-L46

It always writes to the cache, but never reads from it. Is this intended? Is there some Symfony voodoo-magic I'm missing here?

+19 -1

0 comment

2 changed files

pr created time in a month

push eventtjhorner/Parchment

TJ Horner

commit sha 5084559f3b7db5a805fd8a9c0fd89613ac7dbd03

chore: Slightly improve hashing logic

view details

push time in a month

create barnchtjhorner/Parchment

branch : build-hashes

created branch time in a month

startededgar-zigis/SegmentedArcView

started time in a month

push eventtjhorner/discord-gsuite

TJ Horner

commit sha 947b66fea6c852e0874fe1add95baf7bdf75184a

sigh

view details

push time in a month

push eventtjhorner/discord-gsuite

TJ Horner

commit sha 10841570c7bdfd875ca5845f044fb9c9251d34fc

Docker GitHub Actions workflow

view details

push time in a month

create barnchtjhorner/discord-gsuite

branch : master

created branch time in a month

created repositorytjhorner/discord-gsuite

Discord + G Suite Authenticator

created time in a month

push eventtjhorner/vrhr-server

TJ Horner

commit sha bf45158223c7e7d0df314987380ac4603e2cc4ba

ok

view details

push time in 2 months

release tjhorner/vrhr-server

0.0.1

released time in 2 months

created tagtjhorner/vrhr-server

tag0.0.1

The VRHR server

created time in 2 months

push eventtjhorner/vrhr-server

TJ Horner

commit sha 0132dad7d18e5bf1031e499c305db248b7a1099d

lots of stuff

view details

push time in 2 months

more