discord

Heroku Discord Bot builds but doesn't work when deployed

☆樱花仙子☆ 提交于 2021-01-28 08:23:57
问题 I've deployed a Discord bot(discord.py) with heroku. The status of the bot is "online" in the Heroku's Dashboard however the bot is offline in Discord.I've added the Procfile and enabled the dyno in resources. Is there anything else i have to do?? EDIT: This is my procfile's content - worker :python bot.py Requirements.txt: 回答1: You can check the heroku logs using the following command in the command Prompt of your PC (you need to have Heroku CLI installed) heroku logs -a yourappnamehere any

Making a bot delete its own message after a timeout

时光总嘲笑我的痴心妄想 提交于 2021-01-28 08:23:21
问题 I am looking to have my bot send a message, confirming that it executed the command, and then delete that confirmation message after a timeout; so as not to clutter the chat. Here is a code sample of my current command I would like to have it applied to: exports.auth = 1 exports.run = (client, message, args) => { let num = parseInt(args); message.channel.bulkDelete(num+1) .then(messages => console.log(`Bulk deleted ${num} messages`)) .catch(console.error); message.channel.send(`Deleted ${num}

Discord.js Move members to different voice channel

点点圈 提交于 2021-01-28 08:19:56
问题 So, I'm trying to make a command that, when said, provided with a mention and the name of a Voice Channel, moves the member you mentioned to that Voice Channel. I've done a bit of research on this but still can't get it work. const Discord = require('discord.js'); const client = new Discord.Client(); const config = require('../config.json'); exports.run = function(client, message) { const args = message.content.slice(config.prefix.length).trim().split(/ +/g); const command = args.shift()

make an autorole for discord.js v12

核能气质少年 提交于 2021-01-28 07:32:55
问题 I wanna make my bot give automatically role when my friends join for first time to my server: I have tried this one my VPS node version: 12.19.0v :? client.on('guildMemberAdd', member => { console.log('User @' + member.user.tag + ' has joined the server!'); var role = member.guild.roles.cache.find(role => role.name == "Newbie") let user = member.user user.roles.add(role); }); but nothing is working ! help me pls 回答1: Discord is now enforcing privileged intents. The GUILD_MEMBERS intent is

Discord JDA using a local image in an embed?

一笑奈何 提交于 2021-01-28 07:03:06
问题 Is it possible to use a local image file as a thumbnail/image in an embedded message with Discord JDA? For one of my commands i'm building an image programmatically and uploading it via the Imgur API before displaying it in an embedded message using the Imgur URL. I know I can send the file to the channel directly but i'd like it to be contained within an embed that displays other relevant info. Cheers 回答1: You can use attachment://filename.ext as described in the documentation for setImage.

Place the default help command of a Discord bot in a category (Python)

夙愿已清 提交于 2021-01-28 06:30:51
问题 When I used the default help command, it displayed all my commands categorically except for the help command which was under No Category . How do I add this to a cog? 回答1: This might not be the best solution, but you can remove the 'help' command, and re-add the 'help' command within your cog, since discord.py does not allow you to change a command's cog_name . The default help command is stored commands.bot._default_help_command . from discord.ext import commands bot = commands.Bot('.') bot

Discord bot unusually repeats

久未见 提交于 2021-01-28 05:52:29
问题 So I'm trying to create a discord bot that has simple access to a database for printing out values, my code currently will print the values to the discord server but it repeats them 5 times. Bot functionality class: private MySQLAccess sql = new MySQLAccess(); public static void main(String[] args) throws Exception { JDABuilder ark = new JDABuilder(AccountType.BOT); ark.setToken("insert_discord_token_here"); ark.addEventListener(new MessageListener()); ark.buildAsync(); } @Override public

Discord does not embed link when sent by my bot

旧时模样 提交于 2021-01-28 05:36:51
问题 My code works fine and the bot sends the link, but Discord does not recognize it as one and does not embed it. When I copy and paste it myself, it then recognizes it as a link and embed the image. Here is my code: import requests from bs4 import BeautifulSoup if message.content.startswith(".dog"): response = requests.get("https://dog.ceo/api/breeds/image/random") soupRaw = BeautifulSoup(response.text, 'lxml') soupBackend = str(soupRaw).split("message") soup2 = soupBackend[1] soup3 = soup2[3:]

How to get the message content/embed from the message id?

帅比萌擦擦* 提交于 2021-01-28 05:24:46
问题 I want to know how to get a message content (specifically the embeds) from the message id ? Just like you can get the member using a member id 回答1: on_raw_reaction_add() example: @bot.event async def on_raw_reaction_add(payload): channel = bot.get_channel(payload.channel_id) msg = await channel.fetch_message(payload.message_id) embed = msg.embeds[0] # do something you want to Command example: @bot.command() async def getmsg(ctx, channel: discord.TextChannel, msgID: int): msg = await channel

AFK function in Discord Bot

落爺英雄遲暮 提交于 2021-01-28 04:14:19
问题 I'm currently trying to make a bot in Discord using python (something almost brand new for me). I was trying to make an AFK function (similar to Dyno's). This is my code: afkdict = {} @client.command(name = "afk", brief = "Away From Keyboard", description = "I'll give you the afk status and if someone pings you before you come back, I'll tell " "them that you are not available. You can add your own afk message!") async def afk(ctx, message = "They didn't leave a message!"): global afkdict if