Six Nimmt Bot for Telegram using C#
- .Net Framework 4.5.2
- SQL Server
- Windows Server (Or you can run it locally)
- Visual Studio 2017
-
Create a bot and get the bot token from
@botfather
on telegram. -
Create a SQL database using
SixNimmtBot.sql
(to be updated), name itSixNimmt
. -
Open the Registry Editor (
regedit.exe
), findHKEY_LOCAL_MACHINE\SOFTWARE
, then create a newKey
under that folder and name itSixNimmtBot
. Within the key, create 2String Value
s:Key Name Key Value BotToken
(Paste your token here, e.g.: 123456789:botABCDEFGHIJKLMNOPQRSTUVWXYZ
DbConnectionString
(Paste your SQL Connection String here, example see below) - SQL Connection String
- Example:
metadata=res://*/SixNimmtModel.csdl|res://*/SixNimmtModel.ssdl|res://*/SixNimmtModel.msl;provider=System.Data.SqlClient;provider connection string="data source=LOCALHOST,1433;initial catalog=sixnimmt;user id=LOGINNAME;password=LOGINPASSWORD;MultipleActiveResultSets=True;App=EntityFramework"
- Of course replace the server address (
LOCALHOST
), login username (LOGINNAME
) and login password (LOGINPASSWORD
)
- Example:
- SQL Connection String
-
Open
Constants.cs
, update the values forDev
, andLogGroup
.- For
Dev
, it is an array of Telegram's User Id. This is different from yourusername
like@jeffffc
. You can easily obtain an user's ID by forwarding a message to@userinfobot
. - For
LogGroupId
, it is the Chat ID of your desinated Log Group. You can get the ID by using command/chatid
after running your bot for the first time and adding it into the group.
- For
-
Set the project to
DEBUG
mode and clickStart
at the top, a console window will pop up, the title of the console should show you your bot's name, ID and username. -
If everything is fine, you can fire the build using
RELEASE
build and then go to the build folder for theSixNimmtBot.exe
. -
There you go!
This project is using GPLv3 license. You are free to fork and amend the project but you have to keep reference to this initial project and stay open sourced. Details can be found here.