Raised This Month: $ Target: $400

[DISCORD] Command To Server

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


    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.


    - 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.


    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

    Rest In Pawn 1.3
    Discord API

    GitHub Release

    Last edited by genuine; 10-18-2021 at 16:24.
    genuine is offline
    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
    Junior Member
    Join Date: Nov 2019
    Old 10-18-2021 , 17:07   Re: [DISCORD] Command To Server
    Reply With Quote #3

    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
    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
    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:

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

    Originally Posted by genuine View Post

    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.

    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.

    sm_slay @all
    [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.

    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

    Sanjay Singh is offline
    Send a message via AIM to Sanjay Singh
    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

    Thread Tools
    Display Modes

    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 22:52.

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