kibook / poodlechat

Chat resource for Poodle's Palace FiveM/RedM server
13 stars 18 forks source link

Redemrp #4

Closed niodamian closed 3 years ago

niodamian commented 3 years ago

Not supported on Redemrp ?

kibook commented 3 years ago

I am not aware of anyone having used it on a server with RedEM:RP, but there's no particular reason it shouldn't work with it. Can you describe exactly what issues you've encountered using it on your server with RedEM:RP?

niodamian commented 3 years ago

I am not aware of anyone having used it on a server with RedEM:RP, but there's no particular reason it shouldn't work with it. Can you describe exactly what issues you've encountered using it on your server with RedEM:RP?

[ c-scripting-core] Creating script environments for poodlechat [ script:poodlechat] Error parsing script @poodlechat/server/config.lua in resource poodlechat: @poodlechat/server/config.lua:67: unexpected symbol near '{' [ c-scripting-core] Failed to load script server/config.lua. [ script:poodlechat] Error loading script server/server.lua in resource poodlechat: @poodlechat/server/server.lua:11: attempt to index a nil value (global 'ServerConfig') [ script:poodlechat] stack traceback: [ script:poodlechat] @poodlechat/server/server.lua:11: in main chunk [ c-scripting-core] Failed to load script server/server.lua.

niodamian commented 3 years ago

cause its on vorp ! i cant even open the stuff chat

kibook commented 3 years ago

[ script:poodlechat] Error parsing script @poodlechat/server/config.lua in resource poodlechat: @poodlechat/server/config.lua:67: unexpected symbol near '{'

This looks like a typo in your server configuration file, possibly around line 67.

cause its on vorp ! i cant even open the stuff chat

It doesn't require any particular framework. I primarily use it on a server with neither VORP nor RedEM:RP.

If you mean the latest commit and the ServerConfig.Framework setting, I recently added a feature to display your character name in chat rather than your username, at the request of someone using VORP. RedEM:RP support for that feature could be added, I just need an example of retrieving a character's name with the RedEM:RP API.

niodamian commented 3 years ago

[ script:poodlechat] Error parsing script @poodlechat/server/config.lua in resource poodlechat: @poodlechat/server/config.lua:67: unexpected symbol near '{'

This looks like a typo in your server configuration file, possibly around line 67.

cause its on vorp ! i cant even open the stuff chat

It doesn't require any particular framework. I primarily use it on a server with neither VORP nor RedEM:RP.

If you mean the latest commit and the ServerConfig.Framework setting, I recently added a feature to display your character name in chat rather than your username, at the request of someone using VORP. RedEM:RP support for that feature could be added, I just need an example of retrieving a character's name with the RedEM:RP API.

i even done a clean install ..just to make sure its not my fault ! but again gives me those errors....i guess you using vorp system to identify the user but redemrp is using a different system ! would be cool if you at least remove vorp and add steamid inside it ....

kibook commented 3 years ago

The ServerConfig.Framework thing is totally optional. Can you please include the contents of your server/config.lua file? Obviously omit anything sensitive like Discord tokens and steam keys if you filled in those settings.

niodamian commented 3 years ago

The ServerConfig.Framework thing is totally optional. Can you please include the contents of your server/config.lua file? Obviously omit anything sensitive like Discord tokens and steam keys if you filled in those settings.

The ServerConfig.Framework thing is totally optional. Can you please include the contents of your server/config.lua file? Obviously omit anything sensitive like Discord tokens and steam keys if you filled in those settings.

ServerConfig = {}

-- ID of a Discord webhook to post with. Leave as '' to disable sending messages to Discord. ServerConfig.DiscordWebhookId = ''

-- Token for the above Discord webhook. Leave as '' to disable sending messages to Discord. ServerConfig.DiscordWebhookToken = ''

-- The default name to use on Discord. ServerConfig.DiscordName = 'WildWestRP'

-- The default avatar to use on Discord. ServerConfig.DiscordAvatar = ''

-- A Discord bot token, used for getting messages and player avatars. Leave as '' to disable. ServerConfig.DiscordBotToken = ''

-- Discord channel ID to echo messages in-game from. Leave as '' to disable showing Discord messages in-game. ServerConfig.DiscordChannel = ''

-- Colour for messages from Discord ServerConfig.DiscordColor = {115, 138, 219}

-- Discord webhook to post player reports to. ServerConfig.DiscordReportWebhook = ''

-- Colour used for the report message embed on Discord. ServerConfig.DiscordReportColor = 0xfe7f9c

-- Message sent to players upon successfully submitting a report. ServerConfig.DiscordReportFeedbackSuccessMessage = 'I anafora sas echei ypovlitheí.'

-- Message sent to players if a report fails. ServerConfig.DiscordReportFeedbackFailureMessage = '.'

-- Colour for the above feedback message. ServerConfig.DiscordReportFeedbackColor = {255, 165, 0}

-- Time in milliseconds between any two Discord requests. ServerConfig.DiscordRateLimit = 2000

-- A Steam API key, used for getting avatars from Steam. Leave as '' to disable. ServerConfig.SteamKey = ''

-- The ace that grants access to the Staff channel ServerConfig.StaffChannelAce = 'chat.staffChannel'

-- The ace that allows executing commands from Discord ServerConfig.ExecuteCommandsAce = 'chat.executeCommands'

-- The prefix used in Discord chat to execute a command ServerConfig.ChatCommandPrefix = ''

-- Whether to automatically delete chat commands from the Discord channel ServerConfig.DeleteChatCommands = true

-- Messages from players with this ace will be visible regardless of them being muted ServerConfig.NoMuteAce = 'chat.noMute'

-- Framework used to fetch character names. Comment out to disable using character names. ServerConfig.Framework = 'REDEMRP'

-- Roles that can appear in front of player names, based on an ace. -- Optionally, each role can be given a custom colour.

-- Example: -- {name = 'Admin', color = {255, 0, 0}, ace = 'chat.admin'}

-- To show this role for all members of group.admin: add_ace group.admin chat.admin allow ServerConfig.Roles = { {name = 'Admin', ace = 'chat.admin'}, {name = 'Moderator', color = {0, 255, 0}, ace = 'chat.moderator'} {name = 'Superadmin', color = {0, 255, 0}, ace = 'chat.superadmin'} }

kibook commented 3 years ago

You have some typos:

-- To show this role for all members of group.admin:
add_ace group.admin chat.admin allow

The second line should remain commented out. add_ace commands need to be in server.cfg, not a Lua script. This was just an example of what you should add to server.cfg to assign the roles you define to players. Change it back to:

-- To show this role for all members of group.admin:
--   add_ace group.admin chat.admin allow
ServerConfig.Roles = {
{name = 'Admin', ace = 'chat.admin'},
{name = 'Moderator', color = {0, 255, 0}, ace = 'chat.moderator'}
{name = 'Superadmin', color = {0, 255, 0}, ace = 'chat.superadmin'}
}

You need a comma between each item in a table:

ServerConfig.Roles = {
{name = 'Admin', ace = 'chat.admin'},
{name = 'Moderator', color = {0, 255, 0}, ace = 'chat.moderator'},
{name = 'Superadmin', color = {0, 255, 0}, ace = 'chat.superadmin'}
}
niodamian commented 3 years ago

You have some typos:

-- To show this role for all members of group.admin:
add_ace group.admin chat.admin allow

The second line should remain commented out. add_ace commands need to be in server.cfg, not a Lua script. This was just an example of what you should add to server.cfg to assign the roles you define to players. Change it back to:

-- To show this role for all members of group.admin:
--   add_ace group.admin chat.admin allow
ServerConfig.Roles = {
{name = 'Admin', ace = 'chat.admin'},
{name = 'Moderator', color = {0, 255, 0}, ace = 'chat.moderator'}
{name = 'Superadmin', color = {0, 255, 0}, ace = 'chat.superadmin'}
}

You need a comma between each item in a table:

ServerConfig.Roles = {
{name = 'Admin', ace = 'chat.admin'},
{name = 'Moderator', color = {0, 255, 0}, ace = 'chat.moderator'},
{name = 'Superadmin', color = {0, 255, 0}, ace = 'chat.superadmin'}
}

still i have no stuff chat ....for some reason its missing as tab there ...even to i added those lines inside server.cfg.... i though also to remove the -- maybe it will fixthe issue but still the same....you need to change to redemrp...gives me error with vorp

kibook commented 3 years ago

Leave this line commented out for now:

-- ServerConfig.Framework = 'REDEMRP'

You're right that this particular feature doesn't support RedEM:RP yet, so leave it disabled for now. If you're familiar with Lua, you could take a look in server/server.lua and update the GetName function to handle fetching the character's name with the RedEM:RP API. Otherwise, I'll try and find some examples myself and hopefully add something.

You can still get the rest of the chat working without this feature, though, as long as you're okay showing player's usernames rather than their character names for now.

niodamian commented 3 years ago

Leave this line commented out for now:

-- ServerConfig.Framework = 'REDEMRP'

You're right that this particular feature doesn't support RedEM:RP yet, so leave it disabled for now. If you're familiar with Lua, you could take a look in server/server.lua and update the GetName function to handle fetching the character's name with the RedEM:RP API. Otherwise, I'll try and find some examples myself and hopefully add something.

You can still get the rest of the chat working without this feature, though, as long as you're okay showing player's usernames rather than their character names for now.

gives me this error now [ script:poodlechat] [PoodleChat] [error] Failed to initialize: 401 nil []

kibook commented 3 years ago

Your Discord bot token is not correct or the bot may not have access to the specified channel. Make sure the token is valid, that you specified the correct channel ID (not channel name), and that the bot is in your server with at least read access to the channel. If you weren't intending to use the feature where it echoes messages from a Discord channel to the in-game chat, leave the ServerConfig.DiscordBotToken and ServerConfig.DiscordChannel settings as empty strings.

niodamian commented 3 years ago

Your Discord bot token is not correct or the bot may not have access to the specified channel. Make sure the token is valid, that you specified the correct channel ID (not channel name), and that the bot is in your server with at least read access to the channel. If you weren't intending to use the feature where it echoes messages from a Discord channel to the in-game chat, leave the ServerConfig.DiscordBotToken and ServerConfig.DiscordChannel settings as empty strings.

-- Get the last message ID to start from function InitDiscordReceive() PerformHttpRequest( DISCORD_API .. '/channels/' .. ServerConfig.DiscordChannel .. '/messages?limit=1', function(status, text, headers) if IsResponseOk(status) then local data = json.decode(text)

            LastMessageId = data[#data].id

            Log('success', 'Ready to receive Discord messages!')
        else
            Log('error', string.format('Failed to initialize: %d %s %s', status, text, json.encode(headers)))
        end

        if LastMessageId then
            EnqueueDiscordRequest(GetDiscordMessages)
        else
            EnqueueDiscordRequest(InitDiscordReceive)
        end
    end,
    'GET',
    '',
    {
        ['Authorization'] = 'Bot ' .. ServerConfig.DiscordBotToken
    })

end

cfx> [ script:poodlechat] SCRIPT ERROR: @poodlechat/server/server.lua:768: attempt to index a nil value (field '?')

niodamian commented 3 years ago
            LastMessageId = data[#data].id this is the line 768
niodamian commented 3 years ago

Your Discord bot token is not correct or the bot may not have access to the specified channel. Make sure the token is valid, that you specified the correct channel ID (not channel name), and that the bot is in your server with at least read access to the channel. If you weren't intending to use the feature where it echoes messages from a Discord channel to the in-game chat, leave the ServerConfig.DiscordBotToken and ServerConfig.DiscordChannel settings as empty strings.

how you enable the stuff chat ? cause i dont everything still no stuff chat

kibook commented 3 years ago

You mean the staff channel? You need to give the appropriate players the chat.staffChannel ace. So in server.cfg you need something like:

add_ace group.moderator chat.staffChannel allow

Players in principals with that ace will have access to the staff channel.

kibook commented 3 years ago

cfx> [ script:poodlechat] SCRIPT ERROR: @poodlechat/server/server.lua:768: attempt to index a nil value (field '?')

For this, it seems like Discord is returning an invalid JSON response despite a successful status code. f7e00fd should allow poodlechat to handle this and print whatever Discord returned to the server console, which might include the reason why it's failing for you.

niodamian commented 3 years ago

i have a moded poodle if you want me to give it to you

kibook commented 3 years ago

Sure! I'd be happy to take a look at it and see if your redemrp changes can be added to the baseline as an option. If you think it's already good to go, feel free to submit it as pull request.