Giter VIP home page Giter VIP logo

cross-game-chatter's People

Contributors

regener avatar x-eagle-x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cross-game-chatter's Issues

Update for latest discordjs

Sorry for not creating a PR but doesn't seems like a big deal
And thanks for your work

/*
	Cross-Game Chatter v1.6
	By thEsp - https://github.com/x-Eagle-x/Cross-Game-Chatter
*/

const port = 1337;
const targetChannels = ["940368127097708554"];
const inputChannels = ["940368127097708554"]; // leave it so for all, put respectable indexes for specific channels

const auth = require("./auth.json");
const net = require("net");
const { Client, Intents } = require('discord.js');

require("events").EventEmitter.prototype._maxListeners = 0;

const bot = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
bot.login(auth.token);

var message;

function initializeServer()
{
	var server = net.createServer(function(socket)
	{
		socket.on("data", function(data)
		{
			message = data.toString("utf8");

			if (message.startsWith("Map"))
			{
    				bot.user.setStatus("online");
    				bot.user.setPresence({
							status: 'online',
							afk: false,
							activities: [{
            					name: message,
            					type: "PLAYING",
            					url: ""
        				}]
				});
			}
			else
			{
				targetChannels.forEach(channelId => bot.channels.fetch(channelId).then(channel => channel.send(message)));
			}
		});
		
		socket.on("close", function()
		{
			server.close()
		});
		
		bot.on("messageCreate", async msg =>
		{	
			if (msg.author.bot || (inputChannels[0] != "ALL" && !inputChannels.includes(msg.channel.id)))
				return;
			socket.write("(&x03" + msg.author.username + "&x01 - &x03#" + msg.channel.name + "&x01): &x04" + msg.content);
		});
	});

	server.listen(port, "127.0.0.1");
}

initializeServer();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.