我正在制作一个不和谐的机器人,我想知道如何制作一个可以选择随机文字并输出文字的命令?
我想要一个与此类似的命令。另外,我知道C#的基础知识
Commands[ "Joke" ] = {
oplevel:0,
allowed_channels: 'all',
allowed_servers: 'all',
cooldown: 'none',
fn: function( bot, params, msg, msgServer, serverRoles, authorRoles ) {
var answers = [];
answers.push({
message: "Q: What does a dum call a dumpster? A: Bed and Breakfast"
})
answers.push({
message: Q: What did the doughnut say to the loaf of bread? A: If I had that much dough, I wouldn't be hanging around this hole."
})
answers.push({
message: "What does a dum call a dumpster. Bed and Breakfast"
})
answers.push({
message: "Q: What did the doughnut say to the loaf of bread? A: If I had that much dough, I wouldn't be hanging around this hole."
})
answers.push({
message: "Q: What do you call cheese that isnt yours? A: Nacho cheese"
})
答案 0 :(得分:1)
您可以这样做:
int index = random.Next(answers.Count);
var answer = answers[index];
return answer;