mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-29 06:56:23 +01:00
Adds in the Discord Verification system and fixes the bot~
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// Making this file to allow us to easily understand the location of any modifications to the config file made by Chompers and to try and prevent any conflicts happening in the future.
|
||||
// Basically a copy pasta from virgo's configuration.dm file but it'll make life easer for us to just toggle on/off.
|
||||
|
||||
|
||||
/datum/configuration
|
||||
var/discord_restriction = 0
|
||||
|
||||
/hook/startup/proc/read_ch_config()
|
||||
var/list/Lines = file2list("config/config.txt")
|
||||
for(var/t in Lines)
|
||||
if(!t) continue
|
||||
|
||||
t = trim(t)
|
||||
if (length(t) == 0)
|
||||
continue
|
||||
else if (copytext(t, 1, 2) == "#")
|
||||
continue
|
||||
|
||||
var/pos = findtext(t, " ")
|
||||
var/name = null
|
||||
// var/value = null //Commenting out because config doesn't contain any values at the moment. - Jonathan
|
||||
|
||||
if (pos)
|
||||
name = lowertext(copytext(t, 1, pos))
|
||||
// value = copytext(t, pos + 1) //Commenting out because config doesn't contain any values at the moment. - Jonathan
|
||||
else
|
||||
name = lowertext(t)
|
||||
|
||||
if (!name)
|
||||
continue
|
||||
|
||||
switch (name)
|
||||
if ("discord_restriction")
|
||||
config.discord_restriction = 1
|
||||
return 1
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
hub = "Exadv1.spacestation13"
|
||||
//hub_password = "SORRYNOPASSWORD"
|
||||
hub_password = "kMZy3U5jJHSiBQjr"
|
||||
name = "Space Station 13"
|
||||
name = "CHOMPstation | Vore RPing Server | Must be in Discord | 24/7 Extended (Test server)"
|
||||
|
||||
/* This is for any host that would like their server to appear on the main SS13 hub.
|
||||
To use it, simply replace the password above, with the password found below, and it should work.
|
||||
|
||||
@@ -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.
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user