#Github Commit Embed bot
726 messages · Page 1 of 1 (latest)
on the github i want to be able to change the embed to the left as i can have a description + custom name + a different hex color on the left and it stands out more
but still putting my commits out as usual
any helps appreciated
top is basic webhook
bottom is what i want mine like :)
in the Webhooks page of settings in your repo, you can specify a webhook url
github sends a POST request to the specified url
which you can then format however you want
@cobalt beacon Hey, I got interested in this and thought I would give it a go, I think I managed to do it. Have you got anywhere?
could you send me a picture of what yours looks like please?
Are you using express?
no
what are you using then
what do you mean
im a bit confused lol
Did you not get anything done on it lol
im ngl i gave up tryna find stuff as im very new to js and this is basically the only thing i need done with it tbh
i mainly use Lua
Fair lol, I'm in a good mood so I can guide you if you want
thanks :), also could i have a look to see what yours is like ?
Yh yh ofc, I'll send it all
you wanna install express though
so npm i express
question
where do i put that 😭
are you using vs code? it'll be in the terminal
yeah
this may get a bit difficult if you couldn't do that part lol
nah i tried it
and it gave a error
show
so i gave up haha
lemme open rq
if you get any errors just show them lol
alright lemme make a new file
you're also probably gonna wanna install https://ngrok.com/download
oh you don't have it installed
do you have node js installed?
nop
ill download rq
To install run: npm install discord.js
• Documentation: learn more
• Guide: learn more
oh
not that
this?
no no
oh
did you host your github pushs with through developer portal?
yah
and then come to this part
and download the exe file
nvm is node version manager
it's great for installing node
I have my own vps for that
oh alright
downloaded both
open up cmd
ya
idm showing my name, but
open the nvm.exe
run it
then run nvm -v
ya
cool
then
nvm installl v20.0.0
I think
alot of stuff came up
show
it should have done it
yh lol
nvm install 20
it'll install v20.3.0
I think
yeah
the latest one anyway
oh
already done
cool
yeah
now just make a new folder and drop that into vs code
drag what into vsc?
the new folder lol
or do you have vs cod open
code*
yeah
i got it open
oh cool lmao
ok open terminal
npm -v
it returned 9.6.7
coolio
npm i express
err
do you have any like, restrictions on your system
uh no
should i start vsc in administrator/
try thayt yh
that
okay
done
ok err
give me a second
okay
const express = require("express");
const app = express();
app.use(express.json());
app.post('/github', async (req, res) => {
console.log('emitted!');
console.log(req.body);
});
Paste that
in index.js
make a file called that ofc lmao
and make sure this is downloaded
i opened exe
now what
it's installed?
oh
right
yeah
this is in index.js
cool
now i need to remember how ngrok works lmaooo
lol
at the bottom use
app.listen(80, () => console.log('listening at port 80'))
like that?
yh
ok
now do node .
node .
any errors?
in terminal yeah?
yh
oh
inside vs code lol
that is
have i done it wrong?
do node index.js
like that?
err
move that folder into ur desltop or somthing
can't type
in desktop same thing
what...
show the left handside
yh
drag index.js out of help
you can then delete that folder
you should have opened it like inside the main folder
will look like that then
what is that from though?
what is what from
all the folders
are they yours or was i meant to have them
oh they're mine
sorry im abit slower when it comes to new things
oh right
I use them ofr other stuff lol
yeah
so its just a file on my desktop now
lemme try to run it
nope
errr
ok err
is that index.js just on your desktop as a gile?
yeah
make a new folder called like
my project
drag and drop index.js into that folder
new window of vs code, close the other one
in any specific folder
then drag and drop that folder
can i put it in documents
inside a folder of course?
it doesn't matter where it is just make sure index.js is in a foldeer
then drag then folder into vs code
but a new window
yeah
samething
is it saved?
😭
what...
oh
npm init
yh just spam enter
then npm i express again
done
show me the left hand side again
ok
now node index.js
lol
what...
i don't understand that
may i have installed something wrong?
that makes no sense
this works for me just fine
make a new folder called project again
a new empty folder
yeah
new window
then open folder
and choose that folder you just made
yeah
in it
?
show me
why do you have that at the top
fresh
what?
idk
err
npm init
spam enter
npm i express
const express = require("express");
const app = express();
app.use(express.json());
app.post('/github', async (req, res) => {
console.log('emitted!');
console.log(req.body);
});
app.listen(80, () => console.log('listening'))
made
done
now try?
istf if it doesnt
what
?
whats that
what did you do
lemme redo this rq
there?
idk what its on about
maybe i try a different folder name?
oh
dpam enter
spam
lol
oh yeah
done
then npm i express lol
yeah
then index .js
the file
yh make index.js
then poat the code
post
correct so far?
oh
great lol
in your terminal
type
ngrok http 80
it doesnt let me type
ctrl c lol
oh yeah
i open e
opened ngrok tho?
hmnm
Yh hold on
ok
err
ok err
In cmd type ngrok http 80
so command prompt
not terminal
Yh try
Did you not install it
i opened the exe?
this right?
Yh
Mine wouldn’t install properly either
Idk if it’s antivirus or some shit
yeah
Oh it works
Sick
ngrok http 80
what do i do
wat
Close that cmd
Open another with administrative perms
ok
what
i don't get it at all 😭
haha
do i really need all this just for this bot?
if so i would of never been able to do it
you'll use ngrok to get a https link for your post requests
ohhh
so once this works
i can drag it onto my vps
as that will be where it will be
for it all
you have a vps?
💀
yeah
for my fivem server
you could have said it would've made this easier
oh
mb
is it ubuntu/
?*
no
make a git repo
og
windows
oh
L windows
do you have your own website or something
its a fivem server
actually nvm idk how to set that tuff up
stuff
set what up
nvm
how does your github bot look btw
I haven't sorted it out fully yet
does it have description and stuff?
I just got this stuff working
I haven't got anything else working yet
have you tried it out
It's easy now
liike in discord
I've got what I need
to see how it looks
I can just make it how I want
so you could make it exactly like this
the bottom one
I could if I wanted to yh
you just gotta find what each part means
well most of it is just a basic webhook
the bottom part is just the description
and then its got a footer
and obviously the color on left
so what do i do from now
idk why ngrok refuses to install
yeah
neither
do i need to make a ngrok account?
could that be why?
tbh like, I don't think I can help you further
As I use my own website you see
yeah
but lemme try this
OH
I did see lol
Just you got that part working but I can’t get the rest
I don’t think I’d be able to help much more
what actaully am i missing?
I use my website so all post requests get directed there
Idk how to do it with ngrok
can i not just use discord instead?
jesus christ
I got it working
but it's not good code
you're gonna wanna
npm i ngrok
in vs code
const express = require("express");
const app = express();
const ngrok = require('ngrok');
let url;
(async function() {
url = await ngrok.connect(80);
console.log(url)
})();
app.use(express.json());
app.post('/github', async (req, res) => {
res.send(200)
console.log('emitted!');
console.log(req.body);
});
app.post('/', () => {
console.log('post')
})
app.get('/', () => {
console.log('gi')
})
app.listen(80, () => console.log('listening on port 80'))
This is the new code
so this instead of whats in index.js?
yh
what next
node index.js
yeah
its worked
now
what
you copy that link
got to github
repository settings
webhooks
add the webhook
but put /github at the end
then update
like that then yeah?
not putting my ip obvs
yh update
then like star ur repo or something see if anything logs in ur terminal
yeah
starred it
anmd that happened
you 100% copied this?
yeah
no idea then
heres what it is
const express = require("express");
const app = express();
const ngrok = require('ngrok');
let url;
(async function() {
url = await ngrok.connect(80);
console.log(url)
})();
app.use(express.json());
app.post('/github', async (req, res) => {
res.send(200)
console.log('emitted!');
console.log(req.body);
});
app.post('/', () => {
console.log('post')
})
app.get('/', () => {
console.log('gi')
})
app.listen(80, () => console.log('listening on port 80'))```
will this work for sending to discord
?
imma head to sleep
if you get any further
please let me know as ive been looking to maek this for a few days now
thanks
did you manage to get any further?
Yes, I managed to get a webhook to send data. But for you, I don’t know how to integrate the ngrok link with the express server
yeah cause for me i need it to send it to a discord channel
See if yoy can Google/YouTube how to ngrok and express together
I can’t really help you further as I don’t have the knowledge on that part
something like this?
Something like that yh
Would be easier if yoy had your own website or something but I have no idea how to fully set that stuff up
why? is ngrok not really too good for discord or something?
Well without an account and probably a subscription it’s gonna end in 2 hours as each session is 2 hours long
im asking a person who done it
and he said wtf is ngrok
so there must be some other way to do without ngrok
he linked me this https://github.com/ipz1337/github-webhook/blob/main/server.js
Maybe you can just use http then
because then it’ll be http://ur_server_ip:the_port
however im not going to sit here and say i know how to do that though
as i did try this and didnt really get far to be honest
The issue I have is the link, the webhook url yoy give to github to send the post request
As I said, I just use my webhook
Website*
yeah
yeah that nice
i just need one like that of course
then i can sort out the embed
like what i want is basically just a basic github commit
just has the big description box underneath
by the wya would that github webhook bot do the whole channel as
every repository he has in that channel which is around 8 has that bot
or would he of manually added all the webhooks
@sullen idol you got any ideas?
huh
ngrok has a "confirmation page"
when github tries sending to ththje page you specified, it goes to the confirmation page instead, so you dont get the request
i need it to go discord
what
you don’t receive what GitHub sends because it goes to the ngrok confirmation page
e
that
is waht o want it to look like
I find you what to do though
Told*
i need it in discord
Ok?
So, did you get the other stuff working?
what stuff?
this
Run it, get the url pop that into github
yeah
i got it to there
and i said what more ?
put at the end of the url /github
and you said you dont know any furthur
since you use a website
run a test, see if the console.log emits
e
let me find where i stored this
And?
so what did i need to do furthur from here?
should i try this with a tester repository
run it
i need to get the ngrok webhook
as imma try with different repositor
y
Bruh no
did you run uit?
it*
so what npm start run?
node .
node index.js
either or
connection refused
Sounds like an issue with ur system
should i try this on a vps?
to see if it works on there?
upload it there yh
alright gimme a moment
make a new file dont just copy and paste?
or will copy and paste be fine
What?
make a new index.js and copy the writing in
or
copy and paste from my pc into my vps
you can copy that code if you want
just gotta install the other stuff too
yeah ikik
alright
now its saying listening
from node .
so now do node index.js
or do i just need to do one of them
it should also log a url
yes it has
copy it
done
go to github
go to the repo
webhooks
done
ap
paste that url but put /github at the end, should be something like
... .io/github
application json yeah?
json
send me everything yeah
yh
done added
now what do i do from here
Go to here, webhooks -> click that webhook -> recent deliveries
Or, check ur console.log
it should have logged something
if not
go here, click the first one then it should say redeliver
ive tried to redeliver
and its gave a error
ur console.log?
nothing here
well it's not even running there bro 💀
cmon now
it is
where then
there
its saying same thing now
did that url change?
you need to keep it running
this is the issue you'll have with ngrok
oh it did change yeah
shit
idk how else to do it
on my vps itll be fine tho
ill just leave it open ig
Use pm2, or leave a cmd tab open
now ive done it right
and its still got a error?
did you redeliver, change /github at the end?
do i need xampp?
who?
did you redeliver?
yes
dd anything log in the terminal
nothing
do i need to do node . and node index.js
or just one?
they'll do the sme thing
same
oh right
its printed that
idk what that is
That was a get request
Did you put that url in ur browser or something?
yes
so if that works how isnt the github webhook working
i asked the guy who had it
and he said this to me
app.get() handles get requests
used js listened to a port and on github webhook post the payload to the port then got the info put in embed and put it in the channel
app.post() handles post
yes but you need a url
thats how he told me to do this
it's not as easy as just
"put port"!
"put stuff"
"done"!!
thats what i was thinking
yeah
what are you using ro run it
to
wym
?
terminal on vsc
open cmd as admin
done
then cd into that folder
C:\Users\Barns\Desktop\new project
thats my thing
so put that in cmd?
no
cd into it
oh
cd idk what that is
type dir
wtf
alot of stuf
dir means directory
yeah
cd ./Desktop
D
not
d
idk where you are so it's a bit hard
cd ..
cd ..
A
no
cd ..
- File paths explained in detail: learn more
.refers to the current directory..refers to the parent directory- Node path module: learn more
just type
cd
with two dots, right after the other
okay
cd ./Users/Barns
cd ./Desktop
yah
cd ./new project
node index.js
copy new url, paste into github, add /github at the end
It also works just fine for me
its worked
you would have got a tonne of info
yep
const event = req.headers['x-github-event']; that's the event
you can read what each event does, and what it sends
yeah
so
do i put const event = req.headers['x-github-event'];
in here
inside of the app.post
however I think ngrok only works for 2hours on the free version
I'm not too sure
like that?
btw the person who made his
said this
i used js and github
barnsy — Today at 19:39
so nothing else at all?
Bentheborg — Today at 19:39
nope
app.post('/github', async (req, res) => {
res.send(200)
const event = req.headers['x-github-event'];
if(event == 'commit') {
web.send(stuff)
}
})
web you can use djs if you want
app.post('/github', async (req, res) => {
res.send(200)
console.log('emitted!');
console.log(req.body);
});
app.post('/', () => {
console.log('post')
})```
which one does it go in sorry?
no
got it
event is also called "push" for a new commit
yeah
/gtihub one yes
ya
that handles everything coming from the github
got it
alright
you can stop the cmd, type
npm i discord.js
Make a new webhook url
in discord
hi
const web = new WebhookClient({
url: <that url>
})
web.send()
hello
leaking dms now not good
wys
oh yeah because i dont understand how youve done it without all of this stuff tbh
whats ur issue with it
again, as I told you before, I'm using my website. I don't really know other ways to do it
I know this is a way
well im trying to get the github webhooks like how you and a few others have it
and @burnt vale is helping
few others 😱
however gwapes has a website where his goes to
lol
im just trying to make one like it 😄
if you aren't gonna help then why are you even here?
sheesh sorry
pretty sure tho he asked me for help first
so 👍🏿
Well off you pop then
Good luck
dont need it im the one who has done it
Good for you ig?
