Agadê, o sumido (HD Scripts)
Agadê, o sumido (HD Scripts)
DIAdiscord.js - Imagine an app
Created by NatoshiSakamoto on 1/22/2024 in #djs-questions
Using a Discord bot from Nextjs Backend
i'm trying to do this too
5 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
i'm testing... but have error
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
my code:
/* receive from game to discord */
var server = net.createServer(socket => {
//socket.setEncoding("latin1");
var iconv = new Iconv('latin1', 'utf-8');
socket.pipe(iconv).pipe(socket);
socket.on("data", (msg) => {
client.channels.cache.get('1049483595061932102').send(msg).then(() => {
console.log('Message online sent');
console.log(msg);
}).catch(err => {
console.log(err);
});
})
sockets.push(socket);
})
server.listen(1337, "127.0.0.1");
/* receive from game to discord */
var server = net.createServer(socket => {
//socket.setEncoding("latin1");
var iconv = new Iconv('latin1', 'utf-8');
socket.pipe(iconv).pipe(socket);
socket.on("data", (msg) => {
client.channels.cache.get('1049483595061932102').send(msg).then(() => {
console.log('Message online sent');
console.log(msg);
}).catch(err => {
console.log(err);
});
})
sockets.push(socket);
})
server.listen(1337, "127.0.0.1");
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
i found this:
var net = require('net');
var Iconv = require('iconv').Iconv;
var server = net.createServer(function(conn) {
var iconv = new Iconv('latin1', 'utf-8');
conn.pipe(iconv).pipe(conn);
});
server.listen(8000);
console.log('Listening on tcp://0.0.0.0:8000/');
var net = require('net');
var Iconv = require('iconv').Iconv;
var server = net.createServer(function(conn) {
var iconv = new Iconv('latin1', 'utf-8');
conn.pipe(iconv).pipe(conn);
});
server.listen(8000);
console.log('Listening on tcp://0.0.0.0:8000/');
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
how to easily convert?
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
I believe the game is latin1 however, when the message leaves the game for node.js, the letters do not come out as desired
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
hi, sorry for late
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
how to transform to compatible?
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
messages leaving discord for the game, undergo changes
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
because this...
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
sockets[0].setEncoding("latin1").write(`${msg.author.username} : ${msg.content}\0`);
sockets[0].setEncoding("latin1").write(`${msg.author.username} : ${msg.content}\0`);
i'm trying this... not working too
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
FeelsBadMan
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
const net = require('net');
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
let sockets = [];

/* Status when bot starts */
const status = [
'🥇 !help para ajuda',
];

/* Set status and message to bot when online */
client.on("ready", () => {
client.user.setActivity(status[0]);
client.user.setStatus('online');
});

/* receive from game to discord */
net.createServer(socket => {
socket.setEncoding("latin1");
socket.on("data", (msg) => {
client.channels.cache.get('1049483595061932102').send(msg).then(() => {
console.log('Message online sent');
console.log(msg);
}).catch(err => {
console.log(err);
});
})
sockets.push(socket);
}).listen(1337, "127.0.0.1");

/* Send from discord to game */
client.on("messageCreate", msg => {
if (msg.channel.name === "status-servidor" && !msg.author.bot) {
console.log(msg.author.username, msg.content);
sockets[0].write(`${msg.author.username} : ${msg.content}\0`);
};
})

//Token bot
client.login('TOKEN HERE');
const net = require('net');
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
let sockets = [];

/* Status when bot starts */
const status = [
'🥇 !help para ajuda',
];

/* Set status and message to bot when online */
client.on("ready", () => {
client.user.setActivity(status[0]);
client.user.setStatus('online');
});

/* receive from game to discord */
net.createServer(socket => {
socket.setEncoding("latin1");
socket.on("data", (msg) => {
client.channels.cache.get('1049483595061932102').send(msg).then(() => {
console.log('Message online sent');
console.log(msg);
}).catch(err => {
console.log(err);
});
})
sockets.push(socket);
}).listen(1337, "127.0.0.1");

/* Send from discord to game */
client.on("messageCreate", msg => {
if (msg.channel.name === "status-servidor" && !msg.author.bot) {
console.log(msg.author.username, msg.content);
sockets[0].write(`${msg.author.username} : ${msg.content}\0`);
};
})

//Token bot
client.login('TOKEN HERE');
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
code updated too
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
ok, i upgrade to
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
/* Send from discord to game */
client.on("message", msg => {
if (msg.channel.name == "status-servidor" && !msg.author.bot) {
console.log(msg.author.username, msg.content);
sockets[0].write(`${msg.author.username} : ${msg.content}\0`);
};
})
/* Send from discord to game */
client.on("message", msg => {
if (msg.channel.name == "status-servidor" && !msg.author.bot) {
console.log(msg.author.username, msg.content);
sockets[0].write(`${msg.author.username} : ${msg.content}\0`);
};
})
this part is responsable to send a message from discord to game
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
from game to discord, i solve by using "latin1"... but discord > game don't work
25 replies
DIAdiscord.js - Imagine an app
Created by Agadê, o sumido (HD Scripts) on 1/1/2023 in #djs-questions
Discordbot.js (sockets and bridge)
letters with utf8 no working
25 replies