Skip to content

Instantly share code, notes, and snippets.

View lylythechosenone's full-sized avatar
🍩
Working on g

lylythechosenone

🍩
Working on g
  • New York City, NY, USA
  • 12:15 (UTC -04:00)
View GitHub Profile
@lylythechosenone
lylythechosenone / lexer.rs
Created January 16, 2023 14:08
My lexer in logos#277
use logos::Logos;
#[derive(Logos, PartialEq, Eq, Debug)]
pub enum Token<'a> {
#[regex(r"-?[0-9][0-9_]*(\.[0-9_]+)?([eE][\+-][0-9_]+)?([fui][0-9]+)?")]
Number(&'a str),
#[regex(r#""(\\.|[^"\\])*""#, |lex| &lex.slice()[1..lex.slice().len() - 1])]
#[regex(r#"#(\\.|[^#\\])*#"#, |lex| &lex.slice()[1..lex.slice().len() - 1])]
String(&'a str),
#[regex(r"'(\\.|[^'\\])'", |lex| lex.slice().chars().nth(1).unwrap())]
import { Client, Intents, Message, MessageEmbed, User } from 'discord.js'
import { readFileSync, lstatSync, readdirSync } from 'fs'
import { join, extname, resolve } from 'path'
export class Bot {
private client: Client
private commands: object = {}
constructor(token: string, commandPrefix = ",", loggedIn: (r: string) => void = () => {}) {
this.client = new Client({intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS]})