You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
531 B
Ruby
21 lines
531 B
Ruby
def fumo_main(event)
|
|
fumoFolder = "./modules/fumo/fumoPics"
|
|
if directory_exists?(fumoFolder)
|
|
fumoArray = Dir.entries(fumoFolder).select { |f| File.file? File.join(fumoFolder, f) }
|
|
x = fumoArray.length
|
|
rng = rand x
|
|
fumoFile = "#{fumoFolder}/#{fumoArray[rng]}"
|
|
$bot.send_file(event.message.channel, File.open(fumoFile, 'r'))
|
|
else
|
|
event.respond "No fumo folder found. Please fix that."
|
|
end
|
|
end
|
|
|
|
def fumo_getCommand()
|
|
return ["fumo", "fumo_main"]
|
|
end
|
|
|
|
def directory_exists?(directory)
|
|
File.directory?(directory)
|
|
end
|