I have a problem with mentioning role with discord webhook. I'm using discord_webhook library.
When I try to mention a role webhook tags it and it looks fine but it didn't really ping users from that group. The message isn't also highlighted for them. That's not how the group mention should work
In code my mention looks like this:
<#&823xxxxxxxxxxx01>
But in real webhook:
webhook
Do you know how to make the webhook with notification highlithed for specific group? Of course my ping doesn't make classic discord ping sound (or notification)
You can not ping someone inside embed message. You need to send ping first, embed then (or embed first and ping seccond).
It's because discord is thinking you are doing some kind of role list without mentions (like role shop)
Related
I wanted that when I marked a user, the bot added him to the server, I already did something similar, but he only sent an invitation.
ps: I don't have a code example here to add the question, but my bot is in python
#bot.command
async def add_member(ctx, member: discord.Membrer):
await guild.add_member(member)
what I just typed is a theoretical code, I don't know if these commands exist, it's just to illustrate the idea I had
This isn't possible using the bot API. You'll need to make your target user go through the OAuth2 flow with the scope guilds.join, after which you can use the /guilds/{guild.id}/members/{user.id} endpoint with the token you will get to join a guild on a specific user's behalf.
I haven't been looking for an answer to this question for a long time, but I closed it and the help on the browser history didn't help in any way. I tried to do it myself, but it didn't work out. I wanted to make it so that if the bot did not have rights, then he wrote about it and if there were, then he did the action, please help!
Note: This message is written assuming you are using the standard discord.py events and not the bot events, but it obviously also works with the bot events. Just replace "client" with "bot" and instead of "message" use "ctx.message".
You can get your client user via
client.user
To get the member object of the client user, you can use
message.channel.guild.get_member(client.user.id)
Documentation
On member objects you can then call guild_permissions
member.guild_permissions
Documentation
Permission objects are documented here.
Here is an example that sends a message if the bot cannot react to messages.
#client.event
async def on_message(message):
client_member = message.channel.guild.get_member(client.user.id)
if not client_member.guild_permissions.add_reactions:
await message.channel.send("I cannot add reactions in this channel")
return
My goal is to make a Telegram Bot using Python that does the following:
The user types a command
The bot explains what the user should type next.
The user types certain information
I use that info to fetch a value in a python dictionary.
The bot replies with that info
I have already created the bot and set the command. The problem is that I don't know how to keep the bot "listening" . I have looked up in the docs but I have only found getUpdates, which gets the user's responses but only when you hit run.
res=requests.get(url=f"https://api.telegram.org/bot{bot_token}/getUpdates")
I would like to set a webhook, and I know there is a method for this but I'm not shure about how this works.
When you are a PHP programmer, setting the webhook through a URL and using setWebhook would do the trick and telegram will send the result to this link whenever a user sends an update to the bot. But, Python programmers have to use a different approach, I think. The main, and while, the easiest approach to make the bot listen permanently to the request is to python-telegram-bot module.
There are a few links that can help to build your first pythonic bot that can respond to users' updates.:
Python-Telegram-Bot Repository, which is the repository of the module.
A few examples of bots created using this module, can give you insight into the process of creating your first bot.
A conversation bot
I have 2 discord client instances a bot and a user account. I have already figured out how to copy messages from one channel to another channel, basically a on_message event. However, I want to know if there is a way I can use the user account to fetch the messages, I've tried fetching messages in different guilds but they didn't work because the bot was not in the server and the bot is fetching messages. I've tried using the user account instance to do it but it didn't really work.
The comments were there as a guide for myself because I'm not that familiar with Python it's fairly new to me. If anyone knows how I can use the user account to get or fetch the messages I'd appreciate the help...
PS: I know that some of the code isn't needed, I haven't removed anything that isn't needed. I wanted to actually finish the project before inspecting it.
I just wanted to know that I have tried this myself and it is not possible. Because from discord.py's Docs. Which you can find down below, does not allow users (user account) to transfer data to a bot since you would need to request from discord API which leads to user getting banned (Very quickly) theere are some work arrounds but I would suggest not doing so since self botting is against the TOS of discord
https://discordpy.readthedocs.io/en/stable/
EDIT: Another thing is that discord API blocks users from fetching or getting anything using a user account with discord.py
Can I use the discord API in python to harvest messages from a server (not my own server)? Assuming you have an invite link.
Thanks
Yes, it would be possible. If you look under the TextChannel section of the Discord Models section of the discord.py API Reference, there is the TextChannel history() method. This can be used to parse all the messages in a channel. If the limit argument of the method is set to None, then all the messages in the channel will be returned.
Since you say that the bot already has an invite, that implies they have access to a good part of the server. The method I mentioned requires the following permissions for your bot:
See Text Channels
Read Message History
Well, if your using a discord bot, you need them to invite your bot to their server.
Other than that you could theoretically listen with a bot on your own account but that would be against the discord TOS.
You can achieve this through a discord bot. Given that bots respond to events that fire within servers they reside in, you can listen in to incoming messages.
An example of such event can be found in discord-py documentation.