From 1efec854943ec285617431ad0683512b9fbcaa10 Mon Sep 17 00:00:00 2001 From: raven Date: Tue, 10 Jan 2023 12:27:58 -0500 Subject: [PATCH] update --- discordBridge/.env | 3 --- discordBridge/bridge.js | 45 ----------------------------------------- 2 files changed, 48 deletions(-) delete mode 100644 discordBridge/.env delete mode 100644 discordBridge/bridge.js diff --git a/discordBridge/.env b/discordBridge/.env deleted file mode 100644 index 197bf82..0000000 --- a/discordBridge/.env +++ /dev/null @@ -1,3 +0,0 @@ -TOKEN=MTA2MjM4NjI4MjM1MDc3NjQzMA.GxffCt.RWpwcdgSS7zl4aivcXSL3vRL06lcfnmDIx_1Q0 -TOPIC_HASH=64ae5b405f523f45c7ee68287ff89c281c5d297fe2fce622d51650fad7975178 -CHANNEL=928115276438978632 diff --git a/discordBridge/bridge.js b/discordBridge/bridge.js deleted file mode 100644 index 4bb54cc..0000000 --- a/discordBridge/bridge.js +++ /dev/null @@ -1,45 +0,0 @@ -const Discord = require('discord.js'); -const Hyperswarm = require('hyperswarm'); -const b4a = require('b4a'); -const crypto = require('hypercore-crypto'); - -client = new Discord.Client({intents: 32767}) -const swarm = new Hyperswarm(); -let channel - -let topic; - -client.on('ready', () => { - console.log(`Logged in as ${client.user.tag}!`); -}) - -topic = b4a.from("64ae5b405f523f45c7ee68287ff89c281c5d297fe2fce622d51650fad7975178", 'hex') // Generate a random topic - - // Join the swarm network with the topic - swarm.join(topic, { - lookup: true, // Enable peer discovery - announce: true // Enable peer announcement - }); - - swarm.on('connection', (conn, info) => { - console.log(`Connected to a peer for topic ${topic.toString('hex')}`); - - conn.on('data', data => { - // Send the message from the topic to the Discord channel - client.channels.cache.get("818514972610134069").send(b4a.toString(data)); - }); - }); - -client.on('message', msg => { - if (msg.channel.id === '818514972610134069') { - // Send the message from the Discord channel to the topic - swarm.peers(topic, (err, peers) => { - peers.forEach(peer => { - const conn = swarm.connection(peer); - conn.write(b4a.fromString(msg.content)); - }); - }); - } -}); - -client.login("MTA2MjM4NjI4MjM1MDc3NjQzMA.GxffCt.RWpwcdgSS7zl4aivcXSL3vRL06lcfnmDIx_1Q0");