コマンドを作成する必要はありません。自分のIDを持つチャンネルにメッセージを直接送ることができます。
サンプルコード:
const ulong serverId = 38297389272897UL; // the id of your server
const ulong channelId = 78346982689343UL; // the id of the channel
Server findServer(ulong id)
{
foreach(Server server in discord.Servers) // discord is your DiscorClient instance
{
if (server.Id == serverId)
return server;
}
return null;
}
Channel findTextChannel(Server server, ulong id)
{
foreach(Channel channel in server.TextChannels)
{
if (channel.Id == channelId)
return channel;
}
return null;
}
private Channel channel;
private System.Threading.Timer timer;
void load()
{
Server server = findServer(serverId);
if (server != null)
{
channel = findTextChannel(server, channelId);
if (channel != null)
timer = new System.Threading.Timer(send, null, 0, 1000 * 60 * 60 * 24); // 24 hour interval
}
}
void send(object state)
{
channel.SendMessage("your message");
}
は、サーバーまたはチャネル上で右クリックして、サーバーのIDとの確執にチャネルを取得し、コピーIDをクリックすることができます。このオプションがない場合は、設定で開発者モードが選択されていることを確認してください。
コードの画像は、不満足です。人々があなたを助けるために時間を取ることを期待している場合、少なくともあなたの問題を書く時間を取る –
[なぜ質問をするときにSOのコードイメージをアップロードできないのですか?](http://meta.stackoverflow。 com/questions/285551/why-may-i-not-upload-images-of-code-on-so-ask-a-question) –
コードを画像としてアップロードして申し訳ありません...私は問題を修正しました。 – ST33LIO