c# - getting message in a command from the discord chat -
i have line needs recieve message discord text channel.
choice = video[int.parse(commandhandler.message .content)-1].url;
i tried lot of things, including searching in api don't have clue.
here command
[command("join", runmode= runmode.async), summary("joins voice channel")] public async task joinvoice([remainder, summary("the text echo")] string searchp="") { ivoicechannel voicechannel = (commandhandler.last iguilduser).voicechannel; if (voicechannel == null) { await replyasync("u have in channel first"); return; } string choice = ""; videosearch searchrisolts = new videosearch(); if (searchp != "") { if (searchp.contains("https://")) choice = searchp; else { list<videoinformation> video = searchrisolts.searchquery(searchp, 1); await replyasync("1) " + video[0].title + "\n\n2) " + video[1].title + "\n\n3) " + video[2].title); choice = video[int.parse(commandhandler.message .content)-1].url;//here need recive message chat } } if (voicechannel != program.voicechannel) { program.audioclient = await voicechannel.connectasync(); program.voicechannel = voicechannel; } if (program.audioclient!=null) await sendasync(program.audioclient, choice); }
the class containing function should derive basemodule<icommandcontext>
this basemodule contains context, in place contains message looking for.
context.message.content
Comments
Post a Comment