Files
Ban-Data-Tool/ban_list_exporter.gd
T
2026-03-06 23:35:19 +01:00

33 lines
1.1 KiB
GDScript

class_name BanListExporter extends Node
func Export(Punishments:Array[Punishment],file:String) -> void:
var fileaccess:FileAccess = FileAccess.open(file,FileAccess.WRITE)
if !fileaccess:
push_error("!fileaccess is true")
return
var content:String = ""
for punishment in Punishments:
if !punishment.username:
continue
content += "NAME: " + punishment.username + "\n"
content += "UID: " + punishment.uid + "\n"
content += "PUNISHMENT: " + ("MUTE" if punishment.what_punishment ==
punishment.punishment_types.MUTE else "BAN") + "\n"
content += "REASON: " + punishment.punish_reason + "\n"
content += "END_DATE: " + str(punishment.punish_end) + "\n"
fileaccess.store_string(content)
func Exportv1(Punishments:Array[Punishment],file:String) -> void:
var fileaccess:FileAccess = FileAccess.open(file,FileAccess.WRITE)
if !fileaccess:
push_error("!fileaccess is true")
return
var content:String = ""
for punishment in Punishments:
if !punishment.username:
continue
content += "NAME: " + punishment.username + "\n"
content += "UID: " + punishment.uid + "\n"
fileaccess.store_string(content)