Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I need help with a discord bot and coding I never actually coded a discord bot so this is what I need help with. So I need help with making a discord bot chat like if I was to make rules it could make the rules chat pop up like
[USERNAME]
;Rules
Delete The Message I Said
[BOT]
Rules Here
Like this image
This is quite the lengthy response, but I recommend reading the entire thing.
StackExchange is a community where people post and discuss code. With all do respect, I can guarantee you that nobody here, including me, is going to write you code if we cannot see what you have tried or any existing code.
You will definitely have better luck on this site if you have a relevant product that people can look at to find errors and/or help you build upon it.
In the meantime, check out the Unofficial User Discord API Server here: https://discordapp.com/invite/discord-API
When I was in your shoes, this discord server was extremely helpful with answering any questions about the Discord API as 99.9% of the people there know exactly what your issue is and how to solve it. People are always online to take your questions as you build your code.
If you need help with starting your code, the basic steps go as follows:
Pip install the discord API
Create a bot user on https://discordapp.com/developers/docs/intro
Use the bot token to write your code
Because I don't know exactly what progress you have made on your bot thus far, I just strung together some wireframe code in python to get started.
import discord
import asyncio
from discord.ext import commands
description = "desc"
bot = commands.Bot(command_prefix='?', description=description)
#startup command
#bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
#category of main commands
class Main_Commands():
def __init__(self, bot):
self.bot = bot
#ping command test
#bot.command(pass_context=True)
async def ping(ctx):
await bot.say("pong")
#when the user types in ?ping, the bot will return "pong"
#This is an example of a simple command in this language
#RunBot
bot.run("TOKEN GOES HERE")
# (C) 2017
# All rights reserved
# Any part of this program may be used and/or modified at the users discretion
Anyways, I hope this response helped you.
Happy Coding!!
P.S. check out the API Reference http://discordpy.readthedocs.io/en/latest/index.html
What is in that image is an embed. Im my opinion, Discord.js is a very user friendly Discord API. You can find the docs here.
Rich embeds come with the Discord API, and they are really easy to use. Here is an example.
const embed = new Discord.RichEmbed()
message.channel.send({embed});
To actually put something in the message of your embed, you want to add attributes to the embed. They are as follows:
Attributes:
.title("title name")
.setAuthor("Author Name", "URL to picture you want to the left of name, optional")
.setColor(hex color code)
.setDescription("text")
.setFooter("text", "URL to image")
.setImage("URL to image")
.setThumbnail("URL in top right of embed")
.setTimestamp()
timestamp is at the at the bottom, nothing goes in the function
Attributes, continued:
.setURL("URL to make title clickable")
.addField("bold text",
"text")
this is what was used in the image you linked, there can be more than one field.
One more attribute:
.addBlankField(true)
To send the embed, in discord.js, simply do
message.channel.send({embed});
you defined embed earlier
Related
so i've tried making my bot automatically change his profile picture whenever a certain server he's in changes their server icon, so that he takes the server icon and puts it as a pfp, it's a private bot so there's no spam but i was wondering if it could be possible, i asked everywhere and nobody knew.
ive asked everywhere if it was possible and nobody really knew how to, i tried myself but as i'm a beginner it was even worse as i mess up fast. could anyone give me an code for it?
import discord
from discord.ext import commands
bot = commands.Bot(YOUR_TOKEN_HERE)
#bot.event
async def on_guild_update(before: discord.Guild, after: discord.Guild):
if before.icon != after.icon:
await bot.user.edit(avatar=YOUR_URL_HERE)
I want my discord bot to send basic youtube embeds that appear automatically when a link from youtube is pasted on discord by a user.
I do know i need to install and use pytube for this.
Just need some direction on how to connect my bot to youtube.
(I'm new to discord.py)
For example i do !yt mango and the bot sends the top 3 results that come when searched for mango on youtube.
Please help me out
I want my discord bot to send basic youtube embeds that appear automatically when a link from youtube is pasted on discord by a user.
auto-embeds is a default functionality of Discord. When someone posts a link and you have auto-embeds enabled for the server you will be able to watch the YouTube video from the Discord client.
I do know i need to install and use pytube for this.
pytube is for downloading YouTube videos. You don't need to download the video. Thus pytube is not needed.
Just need some direction on how to connect my bot to youtube.
(I'm new to discord.py)
Familiarize yourself with discord.py first. Here is the manual:
https://discordpy.readthedocs.io/en/stable/api.html
Get a basic discord bot running before attempting anything more advanced.
For example i do !yt mango and the bot sends the top 3 results that come when searched for mango on youtube.
To be able to search on YouTube you need Google API. Refer to: https://developers.google.com/youtube/v3/quickstart/python
Here is a possible library you could use: https://pypi.org/project/python-youtube/
On StackOverflow we don't write code for you. We can only guide you in the direction but you have to write the actual code yourself or be more specific with your problem. Break your big problem into smaller tasks and solve those.
StackOverflow is more for debugging faulty code.
I would like to display via command how many voice channels my bot is currently in, is this possible? Maybe also with extra things like the server ID/channel ID. This is not needed though, just the command and the amount would be good.
I already found a method for js but not for Discord.py.
You can use the Bot.voice_clients attribute
voice_states = bot.voice_clients # or client, however you named your instance
await ctx.send(f'I am currently in {len(voice_states)} voice channels')
I have a bot with which you have to verify yourself to be on our Discord server
(The verification takes place in the DM`s)
Recently we have the problem that certain members of our Discord cannot write to the bot.
Everyone allowed everyone to send a message to the person
Each of the people is on our Discord Server, allows the person to write messages and have not blocked the bot
The bot does not issue any error messages
We would be delighted to find a quick solution
Since you haven't provided any code snippets, logs or error messages, it's a bit difficult to assess your situation... but here are some basic troubleshooting steps that you could follow:
Remove and re-authenticate the bot into the server.
Double check that you have enabled DM's.
Check the console for any errors that could pertain to direct messaging issues with users in the server. (especially from successful DM's)
Try to notice any differences between the users in the server who are
able to message the bot, versus those who cannot.
Ensure the bot isn't running more than one instance. (i.e. you might
have more than one bot running on the same token!)
I highly recommend giving more detail, because usually a question pertaining to broken/lost functionality would usually attach code or error logs to help diagnose the issue.
Okay, the problem is that you either didn't enable DMs or the bot is not in the server.
Otherwise, this problem will not occur.
My recast bot is answering fine in its builder but when it is integrated with Slack it skips the only intends which have notions missing and eventually spoiling the whole conversation. How to fix it?
Are you using a conversation_token ? If yes, are you using your slack id as a conversation token ? If you are doing so, you need to check the box "this is the end of my conversation" within the bot builder or using methods implemented in the SDK in order to reset the memory or the conversation of the bot when the conversation ends :)