Discord Bot Chat Problem Help Please
#1

Hello guys sorry for disturbance i was trying to solve this issue with my own mind but i'm totally fail there is alot experience people so please help me to fix this issue actually i create some codes for my discord chat system using discord-connector all is working fine but there is small problem when Ingame player sending message to discord channel its showing double message like bots message to i wanted to turn off or block bot message its only happening with Ingame player bot message also visible ingame so how to disable bot messages thanks in advance
Here is Code

PHP код:
#include <a_samp>
#include <discord-connector>
// HE IS NOOB IS IN SCRIPTER HE JUST HELP ME LAST NIGHT ITS WAS NOT HELP....
// ACTUALLY HE DOWNLOAD OLD VERSION OF PLUGINS THATS WHY PROBLEM SOLVED...
//HE DOWNLOAD THIS FS FROM SOMEWHERE SO ITS TOTALLY FUCKED UP........
new DCC_Channel:g_WelcomeChannelId;
public 
OnPlayerText(playeridtext[])
{
    new 
name[MAX_PLAYER_NAME 1];
    
GetPlayerName(playeridnamesizeof name);
    new 
msg[128]; // The string. We do not need to have it larger than 128, because a message can't be larger than that.
    
format(msgsizeof(msg), "[%s] %s"nametext); // The formatted message. Remember, %s means string - the strings are associated with GetPlayerTeamName(playerid), respectively text.
    
DCC_SendChannelMessage(g_WelcomeChannelIdmsg);
    return 
true;
}
public 
DCC_OnChannelMessage(DCC_Channel:channelDCC_User:author, const message[])
{
    new 
channel_name[1441];
    if(!
DCC_GetChannelName(channelchannel_name))
    return 
0// invalid channel
    
new user_name[32 1];
    if (!
DCC_GetUserName(authoruser_name))
    return 
0// invalid user
       //if(!strcmp(author, "server-bot", true) || channel != Server[DiscordChannel]) return 0;
    
new str[145];
    
format(strsizeof str"[Discord/%s] %s: %s"channel_nameuser_namemessage);
    
SendClientMessageToAll(-1str);
    return 
1;
}
public 
OnFilterScriptInit()
{
g_WelcomeChannelId DCC_FindChannelById("466244174631665675"); // Discord channel ID
return true;
}
public 
OnPlayerSpawn(playerid)
{
new 
name[MAX_PLAYER_NAME 1];
GetPlayerName(playeridnamesizeof name);
if (
_:g_WelcomeChannelId == 0)
g_WelcomeChannelId DCC_FindChannelById("466244174631665675"); // Discord channel ID
new str[128];
format(strsizeof str"Player %s joined the server."name);
DCC_SendChannelMessage(g_WelcomeChannelIdstr);
return 
true;

Reply
#2

Your best bet is to add the following code to your DCC_OnChannelMessage callback:

Код:
if(strcmp(user_name, "Your_Bot_Name", true) == 0) return 0;
(make sure you add this code after the user_name variable is declared)

obviously replacing Your_Bot_Name with the username of your bot.

This will block the bot from sending the message in-game.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)