Comments (5)
I think you will have to extend my chat.js (https://github.com/RJacksonm1/node-dota2/blob/master/handlers/chat.js) code so that you can pass the guild channel type ( DOTAChannelType_Guild ) to the joinChat method to grab the guild channel ID (I.e. pass guild name and chat channel type = guild), and then the rest of the code should work fine with a guild channel. There is the possibility of a channel name conflict if you join a regular chat channel that shares the name as a guild, so that's something to look out for.
When I get some time I might revisit the chat code; I originally wrote it to be compatible with only regular chat channels, however there are certainly some valid use-cases for the other chat types that I should work to enable. I'm currently very busy with another project though, so I may not get around to that any time soon.
RJ
from node-dota2.
Thanks for ur fast answer, before u tell me this i tried to join to a regular chat and tried to send a message, it joins, but doesnt send the message.
Dota2.joinChat("MYNAMECHAT");
setTimeout(function(){ Dota2.sendMessage("MYNAMECHAT", "my msg"); }, 10000);
I mean it says "Sending message to MYNAMECHAT" but it doesnt shows in to the chat room in the game.
Also what do u mean with updating this part?
so that you can pass the guild channel type ( DOTAChannelType_Guild ) to the joinChat method to grab the guild channel ID (I.e. pass guild name and chat channel type = guild),
I replaced:
"channelType": Dota2.DOTAChatChannelType_t.DOTAChannelType_Custom
by :
"channelType": Dota2.DOTAChatChannelType_t.DOTAChannelType_Guild and it doesnt join to the channel.
PD: i know this is maybe wrong >.<!.
Again Thank you for advance!
from node-dota2.
Ah, my apologies. It turns out a change I made before (replacing array maps with filters) caused the problems sending chat messages, and I somehow didn't catch that. I have just fixed it - 658ce56.
I've also tried my suggestion about joining and interfacing with guilds, and you are correct - it doesn't join the guild. Looking at the protobufs I'm not sure what else to suggest right now. The best thing to do would be to inspect the messages Steam itself sends (via SteamRE's NetHook), and then we can figure out how to recreate those messages in with this library. I'll throw it on my todo list, but until then I don't think I can be of much help I'm afraid.
from node-dota2.
Oh thank so much for the fix now it send messages to the regular chats, about inspect Steam via SteamRE's NetHook, i dont know so much about that, maybe there is some guide than i can follow up? or maybe can i contact u in private so i can expend some time trying to figure out about how to join and send messages to guild's chat.
I have another question and i dont know if i should open another post, its about how can i get the ID's Guild? and if i have the steamid how can i get the account id?
I mean to use on this:
guildInvite (guildId, guildName, inviter, guildInviteDataObject)
guildId - ID of the guild.
guildName - Name of the guild.
inviter - Account ID of user whom invited you.
guildInviteDataObject - The raw guildInviteData object to do with as you wish.
I will appreciate if u can give me a hand with this.
Thanks for ur time i know u are bussy, Grettings.
from node-dota2.
The comment about Nethook was just to remind me to look into it, and I have done just that.
It seems when the client launches Dota 2 it sends the message k_EMsgGCRequestGuildData
with an (empty) serialized payload of CMsgDOTARequestGuildData
. The server responds to this with a number of things but most notably for each guild you are in the GC sends a k_EMsgGCGuildOpenPartyRefresh
with a CMsgDOTAGuildOpenPartyRefresh
payload - which contains guild_id
and open_parties
properties. There doesn't seem to be anything to suggest which guild name is associated to which guild_id
, however.
The Dota 2 Client then sends some k_EMsgGCJoinChatChannel
messages, like our existing joinChat method, however it for channel_name
it passes Guild_[guild_id]
, e.g. Guild_2755
, and it also passes channel_type
= DOTAChannelType_Guild
. The GC later responds with channel_ids, as our existing code handles.
So, what we'll need to do is add k_EMsgGCGuildOpenPartyRefresh: 7268,
to the Dota2.EDOTAGCMsg
object in generated/messages.js
, add a method to send k_EMsgGCRequestGuildData
and a handler to receive k_EMsgGCGuildOpenPartyRefresh
in handlers/guild.js
, and then adjust the joinChat function to take DOTAChannelType_Guild
as you have already done.
So, the final program flow to do this would be something like:
- Wait for
ready
event. - Send
requestGuildData
- For each
GuildOpenPartyRefresh
event sendjoinChat("Guild_[guild_id]")
- Use our chat functions as they are written now, but pass the channel name as
Guild_[guild_id]
.
Once you figure out the guild_id
, via the above, you probably wouldn't need to requestGuildData
anymore, just send the joinChat
call straight away.
An account id is the lower 32 bits of a Steam ID, however Javascript is a bit iffy with long numbers, so we have to use a buffer to process this. Here's a snippet of code that should do the job:
require('ref'); // Adds 64 bit method stuffs, as stock buffers only go up to 32 bits.
function getAccountId(steamId64) {
// Takes a 64-bit Steam ID and returns the account ID.
var tmpBuffer = new Buffer(8);
tmpBuffer.writeUInt64LE(steamId64, 0);
return tmpBuffer.readUInt32LE(0);
}
// > getAccountId("76561197989222171");
// 28956443
Feel free to have a go at implementing the guild related code yourself, if you want. Otherwise I'll have a go at it over the weekend.
from node-dota2.
Related Issues (20)
- Watch/interact with replays HOT 3
- Not logging when SteamGuard is off
- multiple lobby
- bot to spectators HOT 1
- Grabbing spectated match stats
- Tips for creating new handler? Want to get daily draft trivia
- requestPracticeLobbyList returns only 5 results
- after leaving lobby issues
- Bot doesn't receive "practiceLobbyUpdate" event after lobby was launched HOT 3
- Bot is not installed HOT 2
- "practiceLobbyUpdate" no longer shows members HOT 4
- practiceLobbyUpdate data missing HOT 4
- .
- Regional channel list HOT 1
- Can I create an auto chess lobby now ? HOT 1
- Bot leaves lobby, leaves unassigned player (black box) HOT 1
- Bot not getting data after leaving game/game that is finished
- How to get lobby result ( members - team win - and others... ) ? HOT 1
- Cannot find module 'protobufjs' HOT 2
- Proposal: Archive node-dota2 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-dota2.