Raised This Month: $51 Target: $400
 12% 

[DISCORD] Command To Server


Post New Thread Reply   
 
Thread Tools Display Modes
Author
genuine
Junior Member
Join Date: Nov 2019
Plugin ID:
7826
Plugin Version:
Plugin Category:
All
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Old 10-18-2021 , 16:18   [DISCORD] Command To Server
    Reply With Quote #1

    Description:

    Now sending commands to server from discord chat is real!

    First of all we need to create bot here. Give needed perms and then invite it. to server.

    Then create 2 text channels in discord:

    1. For sending commands
    2. To read output of commands

    Later we will take ID of these channels and paste in config.

    Important:

    - in channel for sending commands, every message will be sent to server as command, so better hide channel from others
    - unfortunately, not every output will be available in discord because of buffer limit
    - don't even think to make same channel for sending commands and outputs

    After loading plugin, if bot will send message to discord as "READY FOR COMMANDS", then we are ready to go.

    Some screenshots:



    If you get problems on installing, write it on comments and maybe i will make a wiki later.

    ConVars:

    HTML Code:
    "sm_cts_bot_token - Bot token
    "sm_cts_command_channel_id - Channel id to write commands
    "sm_cts_output_channel - Channel id where bot will send output of commands
    "sm_cts_server_id" - ID of your Server
    
    There is a config file in cfg/sourcemod/command_to_server.cfg
    Requirements:

    Rest In Pawn 1.3
    Discord API


    Download:
    GitHub Release
    Source
    __________________

    Last edited by genuine; 10-18-2021 at 16:24.
    genuine is offline
    NanoC
    Veteran Member
    Join Date: Jan 2016
    Location: Argentina
    Old 10-18-2021 , 17:03   Re: [DISCORD] Command To Server
    Reply With Quote #2

    What kind of commands does it allow?
    __________________
    NanoC is offline
    Send a message via Skype™ to NanoC
    genuine
    Junior Member
    Join Date: Nov 2019
    Old 10-18-2021 , 17:07   Re: [DISCORD] Command To Server
    Reply With Quote #3

    Quote:
    Originally Posted by NanoC View Post
    What kind of commands does it allow?
    Anything that ServerCommand can take. You can punish players, add privilegies with some plugin and etc

    Command "status" will not respond on discord if there are too much online players in csgo server because of buffer size limit
    __________________
    genuine is offline
    pedrotski
    Member
    Join Date: Nov 2020
    Old 10-18-2021 , 23:55   Re: [DISCORD] Command To Server
    Reply With Quote #4

    Awesome work mate!
    __________________
    pedrotski is offline
    Tonblader
    Senior Member
    Join Date: Jul 2011
    Location: Peru
    Old 10-20-2021 , 00:41   Re: [DISCORD] Command To Server
    Reply With Quote #5

    If someone have this error:

    Code:
    [discord_api.smx] [DISCORD] Couldn't Retrieve Guilds - Fail 0 401
    To fix need use Discord-API version:

    Quote:
    Originally Posted by genuine View Post
    Requirements:

    Discord API
    apart from this, can you make a method where it is possible to use the command itself as an output-console to avoid this error?

    [discord_api.smx] [DISCORD] Couldn't Send Message - Fail 0 400

    I say this because direct commands such as example sm_slay @all does not have a response in the output-console.

    Example:
    You whrite: (in discord input commands chat text)
    sm_slay @all
    Then the answer: (in discord output commands chat text)
    sm_slay @all

    Or maybe you can use the chat reply instead of what I mentioned above, only if it doesn't detect any messages on the console.

    Example:
    console-input:
    sm_slay @all
    console-output:
    [SM] all players dead.

    Another question I have, is it possible that you can add some type of cvar or configuration where only specific discord roles can work?
    This is to prevent using 2 different chat channels (being able to use only 1 same channel) and so that other people can see the discord console, but cannot use it.

    Edit:
    When a Listen Server game takes time to load, the plugin does not load correctly, so the plugin must be reloaded to work correctly, also this generates a problem that the bot sends the message "READY FOR COMMANDS" every time that the plugin reloads.

    What I did to "fix" this problem was to install this plugin:
    [Any] Delay Command
    and Put in my server.cfg (dedicated server) or listenserver.cfg (listening server) this command, example:
    sm_delaycmd_rcon 20 sm plugins reload source_command_to_server.smx

    Last edited by Tonblader; 10-30-2021 at 06:43.
    Tonblader is offline
    Sanjay Singh
    Veteran Member
    Join Date: Sep 2016
    Old 05-16-2022 , 11:09   Re: [DISCORD] Command To Server
    Reply With Quote #6

    https://i.imgur.com/MISQDKP.png
    __________________
    Sanjay Singh is offline
    Send a message via AIM to Sanjay Singh
    eyal282
    Veteran Member
    Join Date: Aug 2011
    Old 05-17-2022 , 14:45   Re: [DISCORD] Command To Server
    Reply With Quote #7

    Can you make it ignore bots, so I can make the send and receive channels the same channel?
    __________________
    I am available to make plugins for pay.

    Discord: Eyal282#1334
    eyal282 is offline
    eyal282
    Veteran Member
    Join Date: Aug 2011
    Old 12-06-2022 , 08:04   Re: [DISCORD] Command To Server
    Reply With Quote #8

    Message content intent causes trouble. If a message's content is empty, you should consider throwing an error in the output channel regarding the fact that you need the message content intent, because messages cannot be empty, and if you get empty string for message.getContent, it's probably message intent.
    __________________
    I am available to make plugins for pay.

    Discord: Eyal282#1334
    eyal282 is offline
    Nightmare Pyro
    Member
    Join Date: Mar 2020
    Location: Cedar Falls
    Old 05-26-2023 , 01:30   Re: [DISCORD] Command To Server
    Reply With Quote #9

    Is this still working? It seems not to respond to my command in discord.
    Nightmare Pyro is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 12:03.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode