Adds in the Discord Verification system and fixes the bot~

This commit is contained in:
AnonymousHybi
2018-05-20 01:32:12 +01:00
parent f28646dffe
commit e7822eb506
9 changed files with 113 additions and 36 deletions
+27
View File
@@ -251,6 +251,8 @@
//Panic bunker code
if (isnum(player_age) && player_age == 0) //first connection
log_adminwarn("[key] has joined for the first time.") //Chompstation edit, notifying admins of a first join <3
message_admins("[key] has joined for the first time.")
if (config.panic_bunker && !holder && !deadmin_holder)
log_adminwarn("Failed Login: [key] - New account attempting to connect during panic bunker")
message_admins("<span class='adminnotice'>Failed Login: [key] - New account attempting to connect during panic bunker</span>")
@@ -258,6 +260,13 @@
qdel(src)
return 0
// Chompstation edit, adds restriction that you can only join with discord account linked to your ckey - Jonathan
if(config.discord_restriction && !IsDiscordLinked(ckey))
to_chat(src,"This server requires you to be linked to the Chompers Discord server in order to connect. Please head to https://chompstation.tk to find out more about our server.")
qdel(src)
return 0
// Chompstation edit end
// VOREStation Edit Start - Department Hours
if(config.time_off)
var/DBQuery/query_hours = dbcon.NewQuery("SELECT department, hours FROM vr_player_hours WHERE ckey = '[sql_ckey]'")
@@ -372,3 +381,21 @@ client/verb/character_setup()
set category = "Preferences"
if(prefs)
prefs.ShowChoices(usr)
// Chompstation Edit, adding a proc to check if their account is linked to discord. - Jonathan
/proc/IsDiscordLinked(ckey)
establish_db_connection()
if(!dbcon.IsConnected())
return null
var/sql_ckey = sql_sanitize_text(ckey)
var/DBQuery/query = dbcon.NewQuery("SELECT * FROM discord2byond WHERE ckey = '[sql_ckey]'")
query.Execute()
if(query.NextRow())
if(ckey in query.item)
return 1
else
return 0
// Chompstation Edit end.
+7 -6
View File
@@ -1,17 +1,18 @@
/proc/send2irc(var/channel, var/msg)
/proc/send2irc(var/msg, var/admin = 0)
if(config.use_irc_bot)
paranoid_sanitize(msg)
ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [channel] [msg]")
if(admin)
msg = "ADMIN - [msg]"
// 3rd param is unused in the bot, would spend time to fix this but I'm lazy. - Jon
ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] null [msg]")
return
/proc/send2mainirc(var/msg)
if(config.main_irc)
send2irc(config.main_irc, msg)
send2irc(msg)
return
/proc/send2adminirc(var/msg)
var/queuedmsg = "ADMIN - [msg]"
send2irc(config.admin_irc, queuedmsg)
send2irc(msg, 1)
return
/hook/startup/proc/ircNotify()