Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1.62 KB

README.md

File metadata and controls

32 lines (23 loc) · 1.62 KB

discord-bot-csharp

A very simple discord bot written in c#

To run the bot, you need to:


1.) Install the .NET Core SDK on your machine if you haven't already. You can download it from the .NET website: https://dotnet.microsoft.com/download.
2.) Copy the script to a file and save it with a .cs file extension.
3.) Open a command prompt or terminal window and navigate to the directory where the file is saved.
4.) Run the following command to compile the script:
`dotnet build`
5.) Run the following command to start the bot:
`dotnet run`
The bot should now be running and ready to respond to commands in your Discord server. You can invite it to your Discord server by generating an invite link using the Discord Developer Portal.

Notes / Usage

This bot responds with "Hello, {user}!" whenever it receives a message that says "!hello".

You can also use "!ping" and it will respond with "Pong!" and the response time.

This bot responds to the !weather command with the current temperature and humidity in the specified city. The weather data is obtained from OpenWeatherMap API.

This bot loads custom commands from a text file named commands.txt in the same directory as the executable file. The file format is one command per line, in the format of command=response. For example:
!dice=Rolling the dice...
!coinflip=Flipping a coin...

To use this code, create a commands.txt file in the same directory as the executable file and add your custom commands to the file in the format of command=response.

This Discord Bot was made for Educational Purposes as an Example