Skip to content

Commit

Permalink
Added actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Struck713 committed Jul 22, 2023
1 parent 87ca930 commit 59d3105
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 5 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ci

on:
push:
branches: ['release']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:18

WORKDIR /app
COPY package*.json ./
COPY tsconfig.json ./
COPY src /app/src

RUN npm install
RUN npm run build

CMD [ "node", "dist/src/app.js" ]
6 changes: 3 additions & 3 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Client, Events, GatewayIntentBits, REST, Routes } from "discord.js";
import { Client, Events, GatewayIntentBits } from "discord.js";
import { TOKEN } from '../config.json';
import { Commands, deploy } from "./lib/command";
import { Commands } from "./lib/command";
import { VoiceManager } from "./lib/voice";

const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates ] });
export const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.MessageContent ] });
export const voiceManager = new VoiceManager();

client.once(Events.ClientReady, async client => {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/voice/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const Queue: Command = {
.setDescription(`by ${playing.getAuthor()}`)
.setThumbnail(playing.getThumbnailUrl())
.addFields({ name: '\u200B', value: 'Next in the queue:' })
if (queue.length > 0) embed.addFields(queue.slice(0, Math.min(8, queue.length)).map((metadata, index) => ({ name: `${index + 2}. ${metadata.getTitle()}}`, value: `by ${metadata.getAuthor()}` })));
if (queue.length > 0) embed.addFields(queue.slice(0, Math.min(8, queue.length)).map((metadata, index) => ({ name: `${index + 2}. ${metadata.getTitle()}`, value: `by ${metadata.getAuthor()}` })));
else embed.addFields({ name: 'There is nothing next in the queue.', value: '\u200B' })
await Embeds.send(interaction, () => embed);
return;
Expand Down
3 changes: 2 additions & 1 deletion src/lib/voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export class VoiceConnection {
let voiceConnection = this.get();
if (!voiceConnection) return false;

const stream = ytdl(url, { filter: "audioonly" });
const stream = ytdl(url, { filter: "audioonly" })
.on("error", _ => this.next());
this.resource = createAudioResource(stream);
this.audioPlayer.play(this.resource);

Expand Down
9 changes: 9 additions & 0 deletions src/listeners/bruh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Events } from "discord.js";
import { client } from "../app";

client.on(Events.MessageCreate, async message => {
if (message.author.bot) return;
if (message.content.toLowerCase().includes("bruh")) {
await message.channel.send("bruh");
}
});

0 comments on commit 59d3105

Please sign in to comment.