AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [TF2] MySQL Donation Bot (https://forums.alliedmods.net/showthread.php?t=259775)

RTWNick 03-12-2015 17:20

[TF2] MySQL Donation Bot
 
C# MySQL Donation Bot
WARNING! THIS BOT IS OLD. YOU CAN STILL USE IT BUT IT MIGHT NEED TO BE UPDATED.


Introduction: I have seen many people on this forum requesting trade bots to do whatever function they want, but most want it to handle donations. So far, most people have not been successful in obtaining one. I have decided to release this MySQL Donation bot for AlliedModders Donors Only. I released it initially on the donor forums only, but now I'm moving it to public.

Fuctions
  • Logs any trades to a MySQL Database
  • Accepts any items, but keys are logged into the database.
  • Defined strings which give a key its value in donor days.
  • Sends the set SteamID a message when a trade is recieved. (Must edit source code to change this)

Setting Up The Bot

Head to Bin/Release/settings.json
Code:

{
"Admins":["Your SteamID 32 Here"],
"ApiKey":"Your API Key Here",
"mainLog": "syslog.log",
"UseSeparateProcesses": "false",
"AutoStartAllBots": "true",
"Bots": [
        {
            "Username":"Place Username Here",
            "Password":"Place Password Here",
            "DisplayName":"Donation Bot",
            "ChatResponse":"Hi. I am a bot!",
            "logFile": "TestBot.log",
            "BotControlClass": "SteamBot.Donations",
            "MaximumTradeTime":180,
            "MaximumActionGap":30,
            "DisplayNamePrefix":"Bot ",
            "TradePollingInterval":800,
            "LogLevel":"Success",
            "AutoStart": "true",
            "conString": "SERVER="Server";PORT=3306;DATABASE="derp_mcherp";UID="SQL User";PASSWORD="password1";",
            "_1":"10",
            "_2":"20",
            "_3":"30",
            "_4":"45",
            "_5":"55",
            "_6":"70",
            "_7":"80",
            "_8":"100",
            "_9":"120"
        }
    ]
}

Edit the strings above ("_3":"30") = (3 Keys: 30 Days)

Once your bot is complete, you will need to do put in your steam guard code for the profile.

Code:

auth 0=code
Last step is to connect your bot to your MySQL Database

Code:

"conString": "SERVER="Server";PORT=3306;DATABASE="derp_mcherp";UID="SQL User";PASSWORD="password1";",
To change the notification user. (Please change it, I no wants spams)

Head to SteamBot/Donations.cs

Code:

Bot.SteamFriends.SendChatMessage(YourSteamID32Here, EChatEntryType.ChatMsg, idname + "<" + currentid + "> donated " + keysadded + "key<s>.");
And you're done. :)

Running The Bot

Head to Bin/Release/SteamBot.exe

Click on it, it will log your bot in and you will need to input your steamguard code. Use the format above (auth 0=code)

Notice

All this bot does is record the trades. It does not add donators or remove them. To do that, you will need to make a system of your own.

Credits

Bone - Created this bot (He stopped making bots awhile ago)

Download Link

Click Me - File was to big to add as a attachment.

friagram 03-13-2015 15:21

Re: [TF2] MySQL Donation Bot
 
Is there source on a github?

WildCard65 03-13-2015 16:34

Re: [TF2] MySQL Donation Bot
 
Quote:

Originally Posted by friagram (Post 2273465)
Is there source on a github?

zip contains source

Creampuffyness 03-19-2015 23:42

Re: [TF2] MySQL Donation Bot
 
Anyone have this working? I need something like this to run on a Windows server, interface with sourcebans and/or Donations Control. Will pay for a completed system. PM me.

404UserNotFound 03-20-2015 08:12

Re: [TF2] MySQL Donation Bot
 
This may require extensive recoding to get into a workable state. Someone pointed out some errors in the original thread that I'm not sure are still applicable, but if you are recoding, look out for these:

Quote:

  • The keysadded variable is incremented when a key is added (L:119) but it is not decremented when a key is removed (It just impacts the message that is sent to the bot owner)
  • When the trade is finished, and items other than keys are added, the bot attemts to inform the trade partner, that the bot only accepts keys (L:211)
  • The bot runs the create table query on every successful trade (L:209 ) instead of only once when the bot is initialized. (L:26)
  • A new mysql connection is created everytime a trade is successful (L:179 ) but the connections are never closed
  • Only keys are recorded in the donation table, all other traded items are not recorded

As well, email trade confirmations may be a problem when using this bot. There is a high potential for someone to not confirm the trade if they know the bot will still go through with the donation handling.


I'm not sure if Jessecar's SteamBOT has been updated yet to handle this.

WildCard65 03-20-2015 09:43

Re: [TF2] MySQL Donation Bot
 
Quote:

Originally Posted by abrandnewday (Post 2275931)
This may require extensive recoding to get into a workable state. Someone pointed out some errors in the original thread that I'm not sure are still applicable, but if you are recoding, look out for these:

[/LIST]As well, email trade confirmations may be a problem when using this bot. There is a high potential for someone to not confirm the trade if they know the bot will still go through with the donation handling.


I'm not sure if Jessecar's SteamBOT has been updated yet to handle this.

nope: https://github.com/Jessecar96/SteamBot/pull/732

404UserNotFound 03-20-2015 10:04

Re: [TF2] MySQL Donation Bot
 
Quote:

Originally Posted by WildCard65 (Post 2275971)

Well shit. Had a friend help me recode this for my server to handle donations, but since Valve decided it'd be smart to integrate email acceptance for trades, that really screwed things up for me.

RTWNick 03-20-2015 14:53

Re: [TF2] MySQL Donation Bot
 
I have plans on making an all purpose node.js bot sometime after I finish my current projects. Regarding the errors in the bot, I had no knowledge of it as I did not code this bot myself. If someone wants to contribute to this thread, they can post the fixed version of whatever code is broken.

GMMAnonymus 07-28-2015 18:51

Re: [TF2] MySQL Donation Bot
 
Hy!
Could you update the link for this plugin/bot if you still have it?
Thank you

RTWNick 08-13-2015 01:16

Re: [TF2] MySQL Donation Bot
 
Anyone got a copy of the bot that they can upload? Silly old me deleted his own copy and can't find a backup.


All times are GMT -4. The time now is 18:31.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.