#dose anyone know how to change the bots status to do not disturb or to and stats on command
1 messages · Page 1 of 1 (latest)
Hey! Once your issue is solved, press the button below to close this thread!
You will not get any help for v4 since this version has been deprecated.
Try to look at status on v4 docs that's all I can say
there is for V5
can you please send me it
#1095206783880003626
dose this look right?
@listen()
async def on_startup():
change_presence(status=Status.DND, activity='SUP')
i dont know what to do with this one
async def change_presence(
self,
status: Optional[Union[str, Status]] = Status.ONLINE,
activity: Absent[Union[Activity, str]] = MISSING,
) -> None:
"""
Change the bots presence.
Args:
status: The status for the bot to be. i.e. online, afk, etc.
activity: The activity for the bot to be displayed as doing.
!!! note
Bots may only be `playing` `streaming` `listening` `watching` or `competing`, other activity types are likely to fail.
"""
if activity is MISSING:
activity = self.client.activity
elif activity is None:
activity = []
else:
if not isinstance(activity, Activity):
# squash whatever the user passed into an activity
activity = Activity.create(name=str(activity))
if activity.type == ActivityType.STREAMING:
if not activity.url:
self.logger.warning("Streaming activity cannot be set without a valid URL attribute")
elif activity.type not in [
ActivityType.GAME,
ActivityType.STREAMING,
ActivityType.LISTENING,
ActivityType.WATCHING,
ActivityType.COMPETING,
]:
self.logger.warning(f"Activity type `{ActivityType(activity.type).name}` may not be enabled for bots")
if status:
if not isinstance(status, Status):
try:
status = Status[status.upper()]
except KeyError:
raise ValueError(f"`{status}` is not a valid status type. Please use the Status enum") from None
elif self.client.status:
status = self.client.status
else:
self.logger.warning("Status must be set to a valid status type, defaulting to online")
status = Status.ONLINE
self.client._status = status
self.client._activity = activity
await self.gateway.change_presence(activity.to_dict() if activity else None, status)
Ok i will try that
This is my error in on_startup
await bot.change_presence(activity="something", status=Status.DO_NOT_DISTURB)
^^^^^^
NameError: name 'Status' is not defined
This is the code that i runed
@listen()
async def on_startup():
await bot.change_presence(activity="something", status=Status.DO_NOT_DISTURB)
ok
in on_startup
await bot.change_presence(status=Status.DO_NOT_DISTURB, activity="nothing")
^^^^^^
NameError: name 'Status' is not defined
ITs working so far thanks
do you have a script to keep it runing or somthin
anyone know how to make a button panel
is this correct for a button panel or am i missing somthing
channel = bot.get_channel(1130433748232581161)
components = Button(
style=ButtonStyle.GREEN,
label="Click Me",
disabled=False,
)
components: list[ActionRow] = [
ActionRow(
Button(
style=ButtonStyle.GREEN,
label="Click Me",
),
Button(
style=ButtonStyle.GREEN,
label="Click Me Too",
)
)
]
await channel.send("Look, Buttons!", components=components)
But this is my error
line 341
await channel.send("Look, Buttons!", components=components)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: 'await' outside function
oh ok thanks
@cinder adder is there a way you can add await bot.change_presence(status=Status.IDLE, activity="working slowly") to a button when somone cickes it
@cinder adderis there a way you can do multiple buttons so if you click one it will set the bot to different staut
Add another button with a different id
oh ok
Then add it in the on_component function
ok
@cinder adder is this right
@slash_command(
name="prepare",
description="Button prepare"
)
async def prepare(ctx: SlashContext):
channel = bot.get_channel(1130433748232581161)
components = Button(
style=ButtonStyle.GREEN,
label="Click Me",
custom_id="your_id",
disabled=False,
)
components: list[ActionRow] = [
ActionRow(
Button(
style=ButtonStyle.GREEN,
label="Click Me",
),
Button(
style=ButtonStyle.GREEN,
label="Click Me Too",
custom_id="dnd"
)
)
]
await channel.send("Look, Buttons!", components=components)
@listen
async def on_component(ctx: Component):
ctx = event.ctx
if ctx.custom_id == "your_id":
await bot.change_presence(status=Status.IDLE, activity="working slowly")
@listen
async def on_component(ctx: Component):
ctx = event.ctx
if ctx.custom_id == "dnd":
await bot.change_presence(status=Status.DND, activity="nothing")
await ctx.send("Changed to dnd")
shut iup i did and it did not
k
i did
ok
its not working look There is no errors tho
@slash_command(
name="prepare",
description="Button prepare"
)
async def prepare(ctx: SlashContext):
channel = bot.get_channel(1130433748232581161)
components = [Button(
style=ButtonStyle.RED,
label="dnd",
custom_id="dnd",
disabled=False,
),
Button(
style=ButtonStyle.GREEN,
label="idle",
custom_id="idle",
disabled=False,
)]
@listen
async def on_component(ctx: Component):
ctx = event.ctx
if ctx.custom_id == "idle":
await bot.change_presence(status=Status.IDLE, activity="working slowly")
@listen
async def on_component(ctx: Component):
ctx = event.ctx
if ctx.custom_id == "dnd":
await bot.change_presence(status=Status.DND, activity="nothing")
await ctx.send("Changed to dnd")
Nope
@slash_command(
name="prepare",
description="Button prepare"
)
async def prepare(ctx: SlashContext):
channel = bot.get_channel(1130433748232581161)
components = Button(
style=ButtonStyle.GREEN,
label="Click Me",
disabled=False,
)
components: list[ActionRow] = [
ActionRow(
Button(
style=ButtonStyle.GREEN,
label="Click Me",
),
Button(
style=ButtonStyle.GREEN,
label="Click Me Too",
)
)
]
await channel.send("Look, Buttons!", components=components)
@cinder adder ok the buttons are showing but are not doing anything
ok
Done
@slash_command(
name="prepare",
description="Button prepare"
)
async def prepare(ctx: SlashContext):
channel = bot.get_channel(1130433748232581161)
components = Button(
style=ButtonStyle.GREEN,
label="Click Me",
disabled=False,
)
components: list[ActionRow] = [
ActionRow(
Button(
style=ButtonStyle.GREEN,
label="Click Me",
custom_id="idle"
),
Button(
style=ButtonStyle.GREEN,
label="Click Me Too",
custom_id="dnd"
)
)
]
await channel.send("Look, Buttons!", components=components)
@cinder adder
KK
@cinder adder i canrt make it so when you click a button is changes the bot to idle dnd
yes please
Thanks it works
guys, any ideas if this is possible to make bot status online on phone? cuz on one of my server i have bot with this status
It's not intentional by discord
welp i still want to know how tf creator of bot made this status
Part of the log in information for a user/bot is what platform it's running on. Users have mobile/desktop (might include os?), and bots send what library is being used
this bot on C# https://github.com/d4n3436/Fergun
i did little of research and i found how to make it in d.py
https://gist.github.com/tasuren/aa92aa70d3dbda0bc201718f1be8fa76
upd: stackoverflow question about this thing https://stackoverflow.com/questions/70903401/how-do-i-get-mobile-status-for-discord-bot-by-directly-modifying-identify-packet also d.py
I'd look into the gateway part of the code for it
okay, well, we've talked about this before actually
the gist of it: it is possible, but screws around with a lot of statistics collecting discord does thats important to this library and... also discord doesnt officially allow it
if you want to do it, go ahead, but it isnt being supported in ipy on any level
@cinder adder do you have a kick ban and timout command
interactions.py provides support for making and responding to components, like buttons and select menus. Check out the component guide for more information.
@vagrant musk
Created at: <t:1681840634:R>
Last edited: <t:1681842331:R>
Words: 40
Characters: 360
@cinder adder is there a way to send a user a dm with the discord bot
Thanks
@cinder adder U got anything for dm
A bot to user
So it becomes like a warn thing
where do i put .send can you please give me an example
oh my days
i need to learn more stuff
thanks
thanks
@cinder adder Is this right
@slash_command(
name="warn",
description="warn a member"
)
@slash_option(
name="member",
description="Member",
opt_type=OptionType.USER,
required=True
)
@slash_option(
name="reason",
description="reason",
required=False
)
async def warns(ctx: SlashContext, member: interactions.Member):
await member.send("{} reason{}.".format(member), ephemeral=True)
await ctx.send("Member {} was warned succefully.".format(member), ephemeral=True)
where
ok
This the error
line 413, in <module>
@slash_option(
^^^^^^^^^^^^^
TypeError: slash_option() missing 1 required positional argument: 'opt_type'
ok
I got an error @cinder adder
Traceback (most recent call last):
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\client\client.py", line 1890, in __dispatch_interaction
response = await callback
^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\client\client.py", line 1761, in _run_slash_command
return await command(ctx, **ctx.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\command.py", line 132, in call
await self.call_callback(self.callback, context)
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\application_commands.py", line 807, in call_callback
return await self.call_with_binding(callback, ctx, *new_args, **new_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\callback.py", line 43, in call_with_binding
return await callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\main.py", line 420, in warns
await member.send("{} reason{}.".format(member), ephemeral=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: Replacement index 1 out of range for positional args tuple
like this
await member.send("{} reason{}.".format(member) .format(reason), ephemeral=True)
kk
Traceback (most recent call last):
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\client\client.py", line 1890, in __dispatch_interaction
response = await callback
^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\client\client.py", line 1761, in _run_slash_command
return await command(ctx, **ctx.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\command.py", line 132, in call
await self.call_callback(self.callback, context)
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\application_commands.py", line 807, in call_callback
return await self.call_with_binding(callback, ctx, *new_args, **new_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\interactions\models\internal\callback.py", line 43, in call_with_binding
return await callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\matth\Desktop\interactions.py-stable (1)\interactions.py-stable\main.py", line 420, in warns
await member.send("{} reason{}.".format(member) .format(reason), ephemeral=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: Replacement index 1 out of range for positional args tuple
k
this is how it comes out @cinder adder reasonHi.
THIS IS A WARNING
@user so it pings them reason =...
it dosent ping the user tho
k
thanks