github.com/meowstercatel/discordgo@v0.0.0-20250615204139-29b43d676735/examples/dm_pingpong/README.md (about)

     1  <img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
     2  
     3  ## DiscordGo Direct Message Ping Pong Example
     4  
     5  This example demonstrates how to utilize DiscordGo to create a Ping Pong Bot
     6  that sends the response through Direct Message.
     7  
     8  This Bot will respond to "ping" in any server it's in with "Pong!" in the
     9  sender's DM.
    10  
    11  **Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
    12  Discord chat channel for support.**
    13  
    14  ### Build
    15  
    16  This assumes you already have a working Go environment setup and that
    17  DiscordGo is correctly installed on your system.
    18  
    19  From within the dm_pingpong example folder, run the below command to compile the
    20  example.
    21  
    22  ```sh
    23  go build
    24  ```
    25  
    26  ### Usage
    27  
    28  This example uses bot tokens for authentication only. While user/password is
    29  supported by DiscordGo, it is not recommended for bots.
    30  
    31  ```
    32  ./dm_pingpong --help
    33  Usage of ./dm_pingpong:
    34    -t string
    35          Bot Token
    36  ```
    37  
    38  The below example shows how to start the bot
    39  
    40  ```sh
    41  ./dm_pingpong -t YOUR_BOT_TOKEN
    42  Bot is now running.  Press CTRL-C to exit.
    43  ```