none
Why do none of the images send? RRS feed

  • Question

  • using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Discord;
    using Discord.Commands;
    
    namespace Tsuyu
    {
        class MyBot
        {
            DiscordClient discord;
            CommandService commands;
    
            Random rand;
    
            string[] Meme;
            
    
    
            public MyBot()
            {
    
                rand = new Random();
    
               
    
               
    
                Meme = new string[]
                {
                    "Memes/Meme1.png",
                    "Memes/Meme2.png",
                    "Memes/Meme3.jpg",
                    "Memes/Meme4.png",
                    "Memes/Meme5.png",
                    "Memes/Meme6.png",
                    "Memes/Meme7.png",
                    "Memes/Meme8.png",
                    "Memes/Meme9.jpg",
                   "Memes/Meme10.jpg",
                    "Memes/Meme11.jpg",
                    "Memes/Meme12.png",
                    "Memes/Meme13.jpg",
                    "Memes/Meme14.png",
                    "Memes/Meme15.jpg",
                    "Memes/Meme16.jpg",
                    "Memes/Meme17.jpg",
                    "Memes/Meme18.jpg",
                    "Memes/Meme19.jpg",
                    "Memes/Meme20.jpg",
                    "Memes/Meme21.png",
                    "Memes/Meme22.jpg",
                    "Memes/Meme23.jpg",
                    "Memes/Meme24.jpg",
                    "Memes/Meme25.png",
                    "Memes/Meme26.png",
                    "Memes/Meme27.png",
                    "Memes/Meme28.jpg",
                    "Memes/Meme29.png",
                    "Memes/Meme30.png",
                    "Memes/Meme31.png",
                    "Memes/Meme32.png",
                    "Memes/Meme33.png",
                };
    
    
    
                discord = new DiscordClient(x =>
                {
                    x.LogLevel = LogSeverity.Info;
                    x.LogHandler = Log;
                });
                discord.UsingCommands(x =>
                {
                    x.PrefixChar = '!';
                    x.AllowMentionPrefix = true;
                });
    
    
                commands = discord.GetService<CommandService>();
    
                RegistermemeCommand();
                
                discord.ExecuteAndWait(async () =>
                {
                    await discord.Connect("MzY0MzE2MDkzMTEzNjk2MjU2.DLOAig.cVZaluL-9PC1UkuCVxjSkJoU2EI", TokenType.Bot);
                });
    
            }
           
    
            private void RegistermemeCommand()
    
            {
    
                commands.CreateCommand("meme")
                    .Do(async (e) =>
                    {
                        int randomMemeIndex = rand.Next(Meme.Length);
                        string MemeToPost = Meme[randomMemeIndex];
                        await e.Channel.SendFile(MemeToPost);
                    });
    
            }
    
            private void Log(object semder, LogMessageEventArgs e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
    

    I'm making a discord bot for my server, why do none of the memes send?

    Monday, October 2, 2017 12:09 PM

All replies

  • Hi OtakuPug,

    You could a debug pointer and go through step by step to see where program is going wrong. Hope this helps you.


    Thanks,
    Sabah Shariq

    [If a post helps to resolve your issue, please click the "Mark as Answer" of that post or click Answered "Vote as helpful" button of that post. By marking a post as Answered or Helpful, you help others find the answer faster. ]

    Monday, October 2, 2017 12:11 PM
  • Is there anything written in the log event?


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Monday, October 2, 2017 12:40 PM
  • There is nothing written in the log event.
    Monday, October 2, 2017 12:57 PM
  • Hi OtakuPug,

    Thank you for posting here.

    For your question, it is third party library. You could post a new thread in GitHub.

    https://github.com/suicvne/DiscordSharp/issues

    It is not the support range of us, I will move it to off-topic.

    This forum discuss and ask the C# programming language, IDE, libraries, samples and tools. 

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, October 3, 2017 6:22 AM