You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example automatically generates the shilling list if the channel name matches
3
+
any of the allowed_strings words.
4
+
5
+
It then dynamically adds an object, and later calls .update() method to change the initialization parameters
6
+
passed at the start.
7
+
"""
8
+
9
+
importasyncio
10
+
importframeworkasfw
11
+
fromframeworkimporttrace
12
+
13
+
14
+
# Create a list in which we will automatically add guilds
15
+
allowed_strings= {"shill", "advert", "promo"}
16
+
data_to_shill= ( # Example data set
17
+
"Hello World",
18
+
fw.EMBED(title="Example Embed",
19
+
color=fw.EMBED.Color.blue(),
20
+
description="This is a test embed")
21
+
)
22
+
23
+
24
+
asyncdefuser_task():
25
+
# Returns the client to send commands to discord, for more info about client see https://docs.pycord.dev/en/master/api.html?highlight=discord%20client#discord.Client
26
+
client=fw.get_client()
27
+
forguildinclient.guilds: # Iterate thru all the guilds where the bot is in
28
+
awaitfw.add_object(
29
+
fw.GUILD(guild.id, logging=True)
30
+
)
31
+
32
+
# Find channels that match allowed_strings
33
+
channels= []
34
+
forchannelinguild.text_channels: # Iterate thru all the text channels in the guild
35
+
ifany([xinchannel.nameforxinallowed_strings]): # Check if any of the strings in allowed_strings are in the channel name
0 commit comments