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

     1  <img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
     2  
     3  ## DiscordGo Airhorn Example
     4  
     5  This example demonstrates how to utilize DiscordGo to listen for an !airhorn
     6  command in a channel and then play a sound to that user's current voice channel.
     7  
     8  **Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
     9  Discord chat channel for support.**
    10  
    11  ### Build
    12  
    13  This assumes you already have a working Go environment setup and that
    14  DiscordGo is correctly installed on your system.
    15  
    16  From within the airhorn example folder, run the below command to compile the
    17  example.
    18  
    19  ```sh
    20  go build
    21  ```
    22  
    23  ### Usage
    24  
    25  ```
    26  Usage of ./airhorn:
    27    -t string
    28          Bot Token
    29  ```
    30  
    31  The below example shows how to start the bot from the airhorn example folder.
    32  
    33  ```sh
    34  ./airhorn -t YOUR_BOT_TOKEN
    35  ```
    36  
    37  ### Creating sounds
    38  
    39  Airhorn bot uses [DCA](https://github.com/bwmarrin/dca) files, which are 
    40  pre-computed files that are easy to send to Discord.
    41  
    42  
    43  See the below example of creating a DCA file from a MP3 file.  This also works
    44  with WAV, FLAC, and many other file formats. Of course, you will need to [install](https://github.com/bwmarrin/dca/tree/master/cmd/dca#Getting-Started)
    45  FFmpeg and the DCA CLI first.
    46  
    47  ```sh
    48  ffmpeg -i test.mp3 -f s16le -ar 48000 -ac 2 pipe:1 | dca > test.dca
    49  ```