Dew is a Discord bot that allows people on a Discord server to play any libretro compatible emulator.
The bot counts the number of button press since the last simulation, emulates the game for a given duration with the selected input and sends a new message with a GIF of the simulated frames.
It is based on Discord.Net and SK.Libretro.
.NET Core 3.1
- Clone this repo
- Create a new Discord bot from the developer portal
- Create an invite link with messaging and message managing
- Go to src/Settings.cs
- Edit the file like this:
- BotId: the Id of your bot
- ChannelId: the channel in which your bot will be sending messages
- Core: the name of the emulator you will be using (without _libretro.dll)
- RomName: the name of the game rom (without the extension)
- In your console go to the src folder and compile the project with
dotnet build --configuration Release
- Go to bin/Release/netcoreapp3.1 and create a file named token (without any extension) that contains your bot token
- In netcoreapp3.1, create new folders like this: netcoreapp3.1/libretro/cores
- Download the core you want to use here and place it in the cores folder
- Place your game rom in the netcoreapp3.1 folder and run the bot
Alternatively you can use Docker with the provided Dockerfile
Steps 1 to 6 are the same as above
- Create a folder called
ROMs/
in the project root and place your game ROM in it - Create a folder called
cores/
in the project root and place the libretro core (download it here) in it too - Create a text file called
token
in the project root and paste your bot token in it - Run
docker build -e ROM='your_rom_name' -e CORE='your_core_name' -t dew .
in your terminal. The core name should be specified without the_libretro.so
extension, and the ROM name should be specified without the extension - Running
docker run --restart unless-stopped dew
in your terminal should now start the bot. If you want to run the bot in the background, usedocker run -d --restart unless-stopped dew
The Dockerfile exposes a volume to store the saves, you can mount it to a folder on your host machine to keep your saves between rebuilds
You can modify the Buttons array from the Settings class to customize inputs This is mostly useful in cases where you want to have longer movements or turbo press
The button is composed of 3 variables:
- The Id of the libretro button
- The UTF value of the emoji or text your want to be displayed
- The function that is used to determine wether or not the button is pressed
Here are basic examples of press functions:
- (frame) => true
Press the button for the whole duration of the gif - (frame) => frame < 16
Press the button until frame 15 (included) - (frame) => frame % 5 == 0
Press the button every 5 frames, starting at frame 5