天道酬勤,学无止境

I keep getting this error on my discord bot: 'HTTPError [AbortError]: The user aborted a request.'

What does this mean, and how do I fix it, I know for a fact my code is correct and nothing is wrong with it, I checked with multiple friends. I have no idea why this is happening and I need my bot to start working soon.

评论

This is an error happening within the discord.js library if a web request is stuck for a long time, which might happen due to an outage or bad internet connection. Those connections are killed with that error message to free resources.

Those errors should not be fatal and can be ignored.

Expanding flame’s point - put your code in a try catch statement e.g.

try {
//code
} catch (error) {
//error code for example
console.log('an error has occurred')
//if you want no error has occurred log
console.log('')
// ^ will not log anything
}

Alternatively, I’ve researched that it could be something to do with a directory not being referenced properly, so check your code for that.

Hope I helped

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • discord.py rewrite: TypeError: cogs must derive from Cog
    As my bot is getting bigger, I'm trying to implement cogs, however I have ran across a problem. I have my whole code set up and ready, but for some weird reason I keep getting this error: Traceback (most recent call last): File "C:\Users\Lauras\Desktop\Akagi Bot\main.py", line 107, in <module> bot.add_cog("cogs.fun") File "C:\Users\Lauras\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 477, in add_cog raise TypeError('cogs must derive from Cog') TypeError: cogs must derive from Cog My code on main.py looks like this: import discord import asyncio
  • Making a discord bot change playing status every 10 seconds
    I'm trying to make the status for a test discord bot change between two messages every ten seconds. I need the rest of the script to execute while the status message changes, but an error keeps popping up whenever I try to make it work. There's threading in my script, but I'm not entirely sure how to use it in this circumstance. @test_bot.event async def on_ready(): print('Logged in as') print(test_bot.user.name) print(test_bot.user.id) print('------') await change_playing() @test_bot.event async def change_playing(): threading.Timer(10, change_playing).start() await test_bot.change_presence
  • Discord money bot keeping user ID's in json file. When Bot restarts it creats a new (but same) ID for everyone
    When this code runs it works getting the user ID from discord and putting they have 100 money in the json, but once you restart the bot you have to register again and it writes the same user ID in the json file thinking it's a new user when it is not. from discord.ext import commands import discord import json bot = commands.Bot('!') amounts = {} @bot.event async def on_ready(): global amounts try: with open('amounts.json') as f: amounts = json.load(f) except FileNotFoundError: print("Could not load amounts.json") amounts = {} @bot.command(pass_context=True) async def balance(ctx): id = ctx
  • Creating Rule agreement when someone join
    I want to a bot that will set the new member to a role that can only view one channel and have to agree on rules in order to use the server. I have wrote this to do it but I keep getting this error. Ignoring exception in on_member_join Traceback (most recent call last): File "C:\Users\ezter\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "D:\programing\Discord Bots\Osis Nation\Start.py", line 31, in on_member_join role = discord.utils.get(bot.roles, name="Default") File "C:\Users\ezter
  • How can I limit the on_message replies (Discord Python bot)
    I am making a Discord Bot that does various things, including reacting to the person who mentions the bot and reacting to things certain users say in a certain channel. My code (shortened for clarity) is: BOT = os.getenv('DISCORD_BOT_MENTION') CHANNEL = os.getenv('DISCORD_CHANNEL') USER1 = os.getenv('DISCORD_USER1_ID') USER2 = os.getenv('DISCORD_USER2_ID') @bot.event async def on_message(message): content = message.content # Did bot get mentioned? channel = message.channel # Where was the bot mentioned channel_ID = message.channel.id # user = message.author.name # Who mentioned the bot user_ID
  • 如何将音频文件播放到频道中?(How to Play Audio File Into Channel?)
    问题 如何从 Discord 机器人播放音频文件? 需要播放一个本地文件,在JS中,当某条消息被发送时,它会加入输入消息的用户,并将文件播放到该频道。 回答1 GitHub 项目:链接 为了做到这一点,您必须首先确保一些事情。 已安装 FFMPEG 并在 Windows [链接] 中为其设置环境路径安装了 Microsoft Visual Studio (VS) [链接] 安装了 Node.js。[链接] 在 VS 中安装 Discord.js。 从那里开始的步骤非常简单。 创建项目index.js您将开始键入一些代码。 以下是步骤: 将 Discord.js 依赖添加到项目中; var Discord = require('discord.js'); 创建名为bot 的客户端变量; var bot = new Discord.Client(); 3. 创建一个布尔变量以确保系统不会超载请求; var isReady = true; 接下来制作拦截正确消息的函数; bot.on('message', message =>{ENTER CODE HERE}); 创建一个if 语句来检查消息是否正确以及机器人是否准备就绪; if (isReady && message.content === 'MESSAGE'){ENTER CODE HERE} 将机器人设置为未就绪状态
  • Having trouble with heroku and git for my discord bot
    So I'm following this tutorial: https://www.techwithtim.net/tutorials/discord-py/hosting-a-discord-bot-for-free/ and I was getting this error: C:\Users\Joshua\OneDrive\VscodePrograms\MyPythonFolder\Discord>git add . warning: LF will be replaced by CRLF in MyPythonFolder/Discord/.idea/inspectionProfiles/Project_Default.xml. The file will have its original line endings in your working directory warning: LF will be replaced by CRLF in MyPythonFolder/Discord/.idea/inspectionProfiles/profiles_settings.xml. The file will have its original line endings in your working directory error: 'MyPythonFolder
  • I am getting this “Error: FFmpeg/avconv not found!”
    I am trying to create a discord bot, however receive this error every time I try to run a youtube link. Error: FFmpeg/avconv not found! at Function.getInfo (C:\Users\-\discord-bot\node_modules\prism-media\src\core\FFmpeg.js:130:11) at Function.create (C:\Users\-\discord-bot\node_modules\prism-media\src\core\FFmpeg.js:143:38) at new FFmpeg (C:\Users\-\discord-bot\node_modules\prism-media\src\core\FFmpeg.js:44:27) at AudioPlayer.playUnknown (C:\Users\-\discord-bot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20) at VoiceConnection.play (C:\Users\-\discord-bot\node_modules
  • Message not sending because of a “BAD REQUEST” with discord.py
    I'm making a bot with Discord.py and I keep getting an error when trying to send a message with an embed. Here's the error I get: Traceback (most recent call last): File "C:\Users\pc\Documents\Storage\python\NanoBot\bot.py", line 101, in on_message await client.send_message(message.channel, embed=embed) File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed) File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib
  • Discord Bot - "Attribute Error: 'NoneType' object has no attribute 'strip.'
    I'm a new coder, and I've been following atutorial on how to create a discord bot with the code below having been virtually copied the code straight out from the tutorial, and I've create a .env file to store my AuthToken. Every time I run the code, I get error below aforementioned code. Any tips? Thanks in advance! Code: import os import discord from dotenv import load_dotenv load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') client = discord.Client() @client.event async def on_ready(): print(f'{client.user} has connected to Discord!') client.run(TOKEN) Error: Traceback (most recent call last)
  • Discord bot python: discord.errors.ClientException: ffmpeg was not found
    I'm trying to make a discord bot that plays music in a voice channel. It connects to the voice channel, but doesn't play anything. It also gives an error in the console. I'm on Windows and I'm using the discord.py rewrite. My code: import discord, random, datetime, asyncio, nacl, ffmpeg TOKEN = 'What token' client = discord.Client() @client.event async def on_message(message): if message.content.lower() == '$play': if message.content.lower() == '$play': channel = client.get_channel(547155964328149007) vc = await channel.connect() vc.play(discord.FFmpegPCMAudio('mp3.mp3'), after=lambda e: print
  • How to store server and user ids in json file with discord.py
    Yo, so I'm trying to give the bot I'm building more useful configuration per server. But I use channel name right now because I don't know how to automatically get all server and channel ids and store them in a json. My question is, how would i use json to implement a guild config and make the bot automatically fill out the ids of each guild and channel it is in so as to code my bot to use that to set up the channels the bot uses? My bot is built using discord.py rewrite if it helps. --EDIT-- Here is bot.py file with the functions I'm using for my config.json in it. import discord from discord
  • discord.js list all my bot commands
    i made a discord bot with discord.js and tried to do a help command to show the user all available commands. example command: avatar.js module.exports.run = async(bot, message, args) => { let msg = await message.channel.send("doing some magic ..."); let target = message.mentions.users.first() || message.author; await message.channel.send({files: [ { attachment: target.displayAvatarURL, name: "avatar.png" } ]}); msg.delete(); } module.exports.help = { name: "avatar", description: "show the avatar of a user", usage: "[@user]" } Then i tried to send a message with the complete list of the
  • Python Discord Bot, needing the Server ID
    I am creating a discord bot in python, and to keep the data on my computer I am using a dictionary in a text file, but if I want multi-server support for something like config I need to know the server's id. The only thing I found that could've worked is discord.Server.id but it returns <member 'id' of 'Server' objects>. I was wondering if there is any other way to do this in python? My exact code is this: @bot.command(pass_context=True) async def info(ctx): await bot.say("ID: {}".format(discord.Server.id)) which returns ID: <member 'id' of 'Server' objects> when I run c*info (c* being my bot
  • Discord.py Glitch or random error: TypeError: __new__() got an unexpected keyword argument 'deny_new'
    Yesterday, my code was perfectly fine. Everything was running... and it was going great. All of a sudden, this error: TypeError: __new__() got an unexpected keyword argument 'deny_new' pops up in my PyCharm console. I've looked it up on the internet but I've only found a similiar questions with zero answers to it. I hope the stackoverflow community will be able to help me. I did not change my code, all I did was, I tried to host my bot on heroku, and it did not go well. And after my first few attempts, I gave up. But, I found out my bot started going crazy and I couldn't run it anymore :<. Has
  • Python - Gspread Request Error 401
    I'm currently making a Discord-bot that connects to a Google-spreadsheet (gspread). But after I've been running it for a while it starts to hand out errors and it can't connect to my gspread anymore (unless i restart it). The error that I'm receiving: (https://hastebin.com/odutucawuv.tex) Ignoring exception in command sub Traceback (most recent call last): File "C:\Python36\lib\site-packages\discord.py-0.16.10- py3.6.egg\discord\ext\commands\core.py", line 50, in wrapped ret = yield from coro(*args, **kwargs) File "C:\Users\simvid-5\Desktop\Pogomoves\DiscordBot.py", line 65, in sub val =
  • Why can't my bot dm users a welcome message? (Discord.net C#)
    I've been working on a discord bot for the past few days, and I managed to get one of the functions working: (a command that sets a message it's supposed to dm users when they join). I can't seem to get the bot to send the actual message. private async Task Join(SocketGuildUser UID) { if (UID.IsBot || UID.IsWebhook) return; Welcometxt= File.ReadAllText([FILE]); await UID.SendMessageAsync("Your Message Was Sucessfully set!"); } private async Task HandleCommandAsync(SocketMessage arg) { var message = arg as SocketUserMessage; var context = new SocketCommandContext(_client, message); if (message
  • How do you code a purge command
    So I have been search far and wide over the internet, trying to find a possible way to make a purge command. Now I have found quite a lot of different ways to make one, but none of them either suited me in the way I wanted, or simply worked for me. SO to start off, here is my code const Discord = require("discord.js"); // use discord.js const BOT_TOKEN = "secret bot token :)" // bot's token const PREFIX = "*" // bot's prefix var eightball = [ // sets the answers to an eightball "yes!", "no...", "maybe?", "probably", "I don't think so.", "never!", "you can try...", "up to you!", ] var bot = new
  • DeprecationWarning: Collection#find: pass a function instead
    I'm quite a newbie to node.js and I'm currently using discord.js to make a Discord bot. As soon as any bot command gets used the console prints a DeprecationWarning. for example: (node:15656) DeprecationWarning: Collection#find: pass a function instead (node:15656) sometimes is another number, nearly always changing. This is what my code looks like (only one command, I've got multiple, I get this error with all of them though): const botconfig = require("./botconfig.json") const Discord = require("discord.js"); const bot = new Discord.Client(); bot.on("ready", () => { console.log(`Launched $
  • 使用Discord.js发送消息(Send a message with Discord.js)
    问题 我正在尝试制作一个Discord机器人,但是我不太了解Discord.js。 我的代码如下所示: client.on('message', function(message) { if (message.content === 'ping') { client.message.send(author, 'pong'); } }); 问题是我不太了解如何发送消息。 有谁能够帮我 ? 回答1 发送代码已再次更改。 问题和答案中的项目均已过时。 对于版本12,下面将是正确的代码。 此链接中提供了有关此代码的详细信息。 向特定频道发送消息 const channel = <client>.channels.cache.get('<id>'); channel.send('<content>'); 向DM中的特定用户发送消息 const user = <client>.users.cache.get('<id>'); user.send('<content>'); 如果要与用户DM通讯,请注意,漫游器和用户应至少有一个共同的服务器。 希望此答案对版本12之后的用户有所帮助。 回答2 .send()行中有错误。 当前的代码已在discord.js库的早期版本中使用,并且send函数已更改。 要发送消息,请使用以下行: message.channel.send('My Message')