Skip to content

Instantly share code, notes, and snippets.

@Lamparter
Last active August 15, 2024 21:18
Show Gist options
  • Save Lamparter/490a35e2eab1322c2d8b8c0289bb81ba to your computer and use it in GitHub Desktop.
Save Lamparter/490a35e2eab1322c2d8b8c0289bb81ba to your computer and use it in GitHub Desktop.
Random script in Fluid
using Discord;
using pyscript pyautogui;
using System;
// Your bot's token from the Discord Developer Portal
val const _token = string "YOUR_DISCORD_BOT_TOKEN_HERE"
// Define the intents
val var _intents = Discord.Intents.Default()
val const _intents.content = bool True // Needed for accessing message content
val var _client = Discord.Client(Intents=_intents)
@_client.event {
async override Ready():
System.Console.WriteLine("We have logged in as {_client.User}")
async override Message(_message):
// Prevent the bot from replying to itself
if _message.Author is _client.User:
return
// Only respond to messages that start with "!type"
if _message.Content._startswith("!type"):
// Extract the message after the command
val var TextToType = _message.Content[System.Core.Len('!type '):]
// Use pyautogui to type the message on your system
pyautogui.typewrite(text_to_type)
pyautogui.press('enter')
// Send a confirmation message in the Discord channel
await _message.Channel.Send("Typed: {text_to_type}")}
_client.Initialise(_token)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment