本文整理汇总了C#中Discord.DiscordClient.EditMessage方法的典型用法代码示例。如果您正苦于以下问题:C# DiscordClient.EditMessage方法的具体用法?C# DiscordClient.EditMessage怎么用?C# DiscordClient.EditMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Discord.DiscordClient
的用法示例。
在下文中一共展示了DiscordClient.EditMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeDeck
void IModule.Install(ModuleManager manager)
{
_manager = manager;
_client = manager.Client;
InitializeDeck();
ImportListenList();
ImportCards();
manager.CreateCommands("Flip", group =>
{
group.CreateCommand("")
.Description("Flip a coin")
.Do(async e =>
{
Random rand = new Random();
int flip = rand.Next(1, 3);
string side = "";
if (flip == 1)
side = "Heads";
else side = "Tails";
Message m = await _client.SendMessage(e.Channel, "Flipping a coin...");
System.Threading.Thread.Sleep(1500);
await _client.EditMessage(m, "The coin spins high into the air!");
System.Threading.Thread.Sleep(1500);
await _client.EditMessage(m, $"The coin lands... and it's {side}!");
});
});
manager.CreateCommands("Roll", group =>
{
group.CreateCommand("Listen")
.Description("Asks Rollbot to listen to the channel for rolls")
.Do(async e =>
{
ListenToChannel(e.Channel);
if (!_channelsToListenTo.Contains(e.Channel))
{
_channelsToListenTo.Add(e.Channel);
await _client.SendMessage(e.Channel, "Now listening for rolls in here");
}
else
await _client.SendMessage(e.Channel, "Already listening in here");
});
group.CreateCommand("Ignore")
.Description("Asks Rollbot to stop listening to the channel for rolls")
.Do(async e =>
{
IgnoreChannel(e.Channel);
if (_channelsToListenTo.Contains(e.Channel))
{
_channelsToListenTo.Remove(e.Channel);
await _client.SendMessage(e.Channel, "No longer listening for rolls here");
}
else
await _client.SendMessage(e.Channel, "Wasn't listening anyways, haha");
});
group.CreateCommand("")
.Description("Asks for a roll, even if rollbot isn't listening.")
.Parameter("What you'd like to roll.")
.Do(async e =>
{
if (e.Args == null)
{
await _client.SendMessage(e.Channel, "No roll provided");
return;
}
string message = e.Args[0];
GetRoll(_client, e, message);
});
});
manager.CreateCommands("Cards", group =>
{
group.CreateCommand("")
.Description("Provides info on cards")
.Do(async e =>
{
await _client.SendPrivateMessage(e.User, "To draw a card, use !cards draw. To reset the deck, say !cards reset");
});
group.CreateCommand("Reset") //Assumes 0 Jokers.
.Description("Resets the deck.")
.Do(async e =>
{
InitializeDeck(0, e.Channel);
await _client.SendMessage(e.Channel, $"Resetting the deck with no jokers.");
SaveDeck(e.Channel);
});
group.CreateCommand("Reset") //Takes a parameter.
.Description("Resets the deck with a number of jokers.")
.Parameter("Number of jokers to include, if any.")
.Do(async e =>
{
try
{
//.........这里部分代码省略.........