I've been using for member in guild.members (or ctx.guild.members) since creatting my bot this spring and its worked no problem. Then one day, it only lists the bot itself.
Did we get a new version of discord.py or something?
Discord.py 1.5.0+ requires you to enable "Intents". In order to get a member list of a server, you will need to enable the server member intent in the discord developer portal (Click your bot application, and go to the bot tab), take a look at this link: https://discordpy.readthedocs.io/en/latest/intents.html#privileged-intents if you can't seem to find it. After you have done that, you need to do this in your code too.
For the code part, i think it's easier if you take a look at the discord.py docs yourself.
Related
So I came across a bot called GameBot, and when you send a command, it sends buttons like so:
picture
an anyone tell me how they did this??
Buttons are a new discord feature that are not yet supported by the official discord.py library.
There is however a third party library called discord components that is mentioned above, however, it is best to wait until it is supported by discord.py
There is currently no ETA on when buttons and slash commands will be supported however it will be a lot more beneficial to wait than use third party services.
This is a new Discord feature. I personally use this feature for my bot too since the discord-buttons library is outdated, you can use the discord-components library instead.
I have a group chat on Microsoft Teams with 4 members: 3 people and a bot. Is it possible for the bot to add a new member to the existing group chat?
I found the method deleteConversationMember of the class BotFrameworkAdapter, which should remove an existing member. Well, I would need the opposite, adding a new member.
I have also checked Microsoft Teams Graph API, but it seems to be possible only to get members and not add a new one.
As I see from your comment, you're trying to have the bot escalate, or "hand off" to a service desk agent. If that's correct, you can have a look at another model for this altogether, where the user continues to chat with the bot, but the messages are being sent, by the bot, to an agent behind the scenes. This is referred to as a "handoff", and you can see a blog post here and source code (from the blog author) here on github
The BotFrameworkAdapter methods use the Bot Framework REST API, which itself calls channel-specific API's. As you've seen in the Teams Graph API, adding a member to a group chat is not currently supported and even if it was that Graph API is in preview and not suited for production applications. This document explains how to give feedback if you want to request this feature.
As a workaround, I recommend having the bot give the existing group members some instruction on adding the new member to the group themselves.
If you'd like to go with a bot-to-human handoff solution like Hilton suggested, you might be interested in this new sample: https://github.com/arturl/lpproxybot
I have my bot registered in dev.botframework.com. It is published, up and running well. I'm trying to integrate it on Microsoft Teams. For that, I need to create a manifest, which I'm doing using App Studio. When I arrive to the part of configuring the the bot endpoint on App Studio, App Studio says that I need to add teamsappstudio#microsoft.com to my bot, admin textbox in order for it to find my bot. Here's what it says that I should do:
So, I added teamsappstudio#microsoft.com to my bot as an admin as AppStudio says that I should do, but when I click "Setup" in the last part, it shows me the error: "We couldn't access your bot. Make sure you've added "teamsappstudio#microsoft.com" as an admin and try again".
I don't know what else to do!!
Help me with this one guys.
Thank you!
The of Teams App Studio that's live now has a bug - sometimes the email address we extract from your authentication token has uppercase characters. We assumed they were all lowercase but it's likely yours are not. We are changing the logic to ignore case so in a week or two it should work properly.
Sorry for the confusion and hassle.
Question: How to have multiple bots supplying answers to the same Teams chat window a user has with an aggregator bot.
Description:
Several different teams have created bots that can answer questions related to their areas. Picture a services bot, a catalog bot, etc. All of these bots are maintained by their individual area owners, have their own sets of LUIS intents, etc. That works great, but you have to know where to look for each type of question.
Now we'd like to have a single bot for anyone to connect to, to get their questions answered no matter what area the question falls into. The idea is that this aggregator bot would then forward the questions to the appropriate area bot, which would then provide the answer. The scenario here is that someone troubleshooting an issue could ask questions crossing multiple areas in the same place without having to know about each individual area's bot.
The bots are currently hosted in Teams and are C#. So far, our solution has this flow:
Aggregator bot receives the question and asks each bot (through another endpoint specific to this flow) how confident it is that it can answer the question.
Aggregator bot decides which bot(s) to ask the question to, and sends the question off to the regular /api/messages endpoint for the bot.
[Broken] Area bot posts the answer/ auth prompt if needed/ or the start of a conversation to clarify the eventual answer.
We found the bot-to-bot handoff project, but in the readme.MD, it says:
Note: The main bot and each of the sub-bots share the same AppID and
AppPassword. This allows all the bots to share the same conversation
ID, Dialog
Stack,
and Bot State
Data.
This is not possible in Azure, because you can't create multiple bots with the same AppId.
Trying a hack based on that, we found that if we change the bot configuration to use the same MicrosoftAppId and MicrosoftAppPassword in the Application Settings in Azure for all the bots, then everything works fine through the aggregator bot. At that point, you can no longer connect directly to the individual bots anymore. While that is clearly a hack and not a solution, it implies that the problem is authentication based and not something that is implicitly impossible.
There are lots of pieces around that seem like they might help, but we haven't found the documentation to fit them together. This seems like something that should be a common scenario. Ideally we could specify some kind of bot trust at a higher level and not have to specify AppId and AppPassword directly, though we're willing to do that in this case since we're all the same company.
Things we've tried:
Using TrustServiceUrl to trust the aggregator bot from each area
bot, and all the area bots from the aggregator bot. The call was
made in Application_Start in Global.asax for each bot.
The hack described above
Specifying AppId and AppPassword in the BotAuthentication attribute
Number 3 actually solved the auth problem for letting the aggregator bot ask each bot for it's confidence in answering the question when we used it to tag those functions. Specifying the AppId and AppPassword for the aggregator bot in the specification for that endpoint in the individual area bots worked great. But it didn't fix the ability for the individual area bot to post back to the conversation owned by the aggregator bot. In that case, the aggregator bot itself is consuming the answer, and it is an answer and not a flow.
What do we try from here? Is there something we've missed, or is there something fundamentally wrong with the approach we've started with?
I just got into developing my Slack bot, but I don't know (yet) how to do certain things, or if they're even possible.
What I basically want (for example) is that the bot gets my Slack username and returns it to me.
If I would know how to do this, I could integrate much more interesting things into my bot. I did check the documentation, but (as far as I could see) there was nothing on this subject.
Another thing I want to achieve is making the bot do a call to my custom API.
If anyone would give me a helping hand (example/link to some great examples/documentation for example) I would greatly appreciate it!
I managed yesterday to get the information from Slack using a debug command (console.log Object(msg)). This gave me all the information I wanted.