ID:257771
 
//Title: Bug Reporting
//Credit to: DivineO'peanut
//Contributed by: DivineO'peanut

/*
This is a set of commands that allow users to report bugs. Bug reports
can be browsed or downloaded by developers so they can fix them.

Update: removed some unnecessary stuff.
*/


var

// Developers can view reported bugs.
// BYONDers whose ckeys are in this list \
can browse and download the bugs reported \
this session.

list/developers = list("divineopeanut","gufflez","somedeveloper")

// A string containing all bug reports by \
players in this session.

bug_reports as text

client
verb
report_bug(bug as message)

// Bad players could easily write long and nasty bug reports\
which can make the bug reports file too long. This stops them\
by limiting their report's length to 3000 characters.

if(length(bug) > 3000)
bug = copytext(bug,1,3000)

bug_reports += "* [html_encode(bug)] (reported by [ckey]) <br>"

view_bugs()

// Only developers can view bugs.
if(!(ckey in developers))
return

// If no bugs were reported then there's\
nothing to download.

if(length(bug_reports) < 1)
usr << "No bugs were reported during this session."
return


// Open a browser window containing all the bugs \
that were reported in this session.

usr << browse("[bug_reports]","window=BugReports")

download_bugs()
if(!(ckey in developers))
return

if(length(bug_reports) < 1)
usr << "No bugs were reported during this session."
return

// Send a .txt file with the bug report to \
the developer.

text2file(bug_reports,"bug reports.txt")
var/timestamp = time2text(world.realtime,"DD-MM-YYYY")
var/filetitle = "bug reports [timestamp].txt"
usr << ftp("bug reports.txt",filetitle)