haxball / haxball-issues

113 stars 42 forks source link

Send message, command haxball room from discord. #1686

Open vaejoviade opened 2 years ago

vaejoviade commented 2 years ago

When I am in discord, I want to send message form discord. I would like to send message from Haxball room. for example when i write "!duyuru announcement " , people can see this message. Also I want to kick and ban from discord , when i wrote "!kick #id", "!ban #id"form discord.

Could you please help me.

Arkadaşlar discord üzerinden komut ve mesaj göndermek istiyorum odaya . yardımcı olabilirseniz çok sevinirim.

hbenormous commented 2 years ago

https://www.npmjs.com/package/hhh-host

byoxygen commented 2 years ago

https://www.npmjs.com/package/hhh-host

Isn't working properly. Room not opening.

Error Code: Failed to connect to room host. If this problem persists please see the troubleshooting guide.

vaejoviade commented 2 years ago

https://www.npmjs.com/package/hhh-host

Isn't working properly. Room not opening.

Error Code: Failed to connect to room host. If this problem persists please see the troubleshooting guide.

I could not connect, either. which token did you write?

byoxygen commented 2 years ago

https://www.npmjs.com/package/hhh-host

Isn't working properly. Room not opening. Error Code: Failed to connect to room host. If this problem persists please see the troubleshooting guide.

I could not connect, either. which token did you write?

I think related to puppeteer. By @hbenormous needs to update it.

vaejoviade commented 2 years ago

@hbenormous Are you there? please dont just link. Help us come on !!!

09x2019 commented 1 year ago

Turkish: İlk kısımdaki bot, sizin haxball botunuzdur. Burada yazan "token" kısmına https://www.haxball.com/headlesstoken 'den token alıp yapıştırın. İkinci bot ise discord botunuzdur. "your token" kısmına discord botu oluşturduktan sonra tokenini yazmalısınız. "file" kısmına ise haxball botunuzun olduğu dosyayı seçin. Örneğin; file: "bot.js". Bu aşamaların hepsini tamamladıktan sonra tek yapmanız gereken haxball odanızı açmak ve terminale girip discord botunuzu çalıştırmak. Discord botunuzu çalıştırmak için node dosyaName.js Ek bilgi: discord.js yide kurmayı unutmayın. Terminale girip npm i discord.js yazarak discord.js kurulumunu başlatabilirsiniz. Kısa bir sürede bitecektir. Umarım faydalı olmuştur. Herkese iyi şanslar.

English: The bot in the first part is your haxball bot. In the "token" section written here, get a token from https://www.haxball.com/headlesstoken and paste it. The second bot is your discord bot. After creating a discord bot in the "your token" section, you should write your token. In the "file" section, select the file with your haxball bot. For example; file: "bot.js". After completing all these stages, all you have to do is open your haxball room and enter the terminal and run your discord bot. node fileName.js to run your Discord bot. Additional info: Don't forget to install discord.js. You can start the discord.js installation by entering the terminal and typing npm i discord.js. It will be over in a short time. I hope it was useful. Good luck everyone.

  1. your Haxball bot:
var room = HBInit({
    roomName: "My room",
    maxPlayers: 16,
    token: "write your token",
    noPlayer: true
});
room.setDefaultStadium("Big");
room.setScoreLimit(5);
room.setTimeLimit(0);

function updateAdmins() { 
  var players = room.getPlayerList();
  if ( players.length == 0 ) return;
  if ( players.find((player) => player.admin) != null ) return;
  room.setPlayerAdmin(players[0].id, true);
}

room.onPlayerJoin = function(player) {
  updateAdmins();
}

room.onPlayerLeave = function(player) {
  updateAdmins();
}
  1. your Discord bot:
const { Server } = require("hhh-host");

const server = new Server();

server.run({
    file: "local file",
    discordToken: "your discord bot token"
});
byoxygen commented 1 year ago

Our problem is not related to installation. You've got the wrong @09x2019

We are always getting "connection failed" error in opened rooms.

ss-2-hhh

09x2019 commented 1 year ago

Sorunumuz kurulumla ilgili değil. yanlış anladın@09x2019

Açılan odalarda sürekli "bağlantı başarısız" hatası alıyoruz.

ss-2-hhh

Turkish: Bir arkadaşım bunu denedi ve bir sorun yaşamadı. Kurulumu vb. detaylı anlatmamın sebebi yeni başlayanların da anlaması içindi.

English: A friend of mine tried this and had no problems. Installation etc. The reason I explained in detail was for beginners to understand.

@byoxygen

furkanardagul commented 1 year ago

Sorunun ile ilgili discord üzerinden iletişime geçebilirsin.

You can contact us on discord regarding your problem.

Furkans#9603