Skip to content

Commit

Permalink
Merge pull request #43 from ccil-kbw/add-masjid-data
Browse files Browse the repository at this point in the history
feat: add simple data
  • Loading branch information
serafdev authored May 5, 2024
2 parents 4bb85e1 + c51fac2 commit be5682b
Show file tree
Hide file tree
Showing 34 changed files with 10,584 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
run: |
echo "$(git describe --tags)"
echo "version=$(git describe --tags)" >> "$GITHUB_OUTPUT"
./tools/bump_version.sh "$(git describe --tags)"
git add ./internal/version/version.go
git add ./README.md
git commit -m "Bump version to $(git describe --tags) [skip ci]"
releases-matrix:
needs: release
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
python/
.vscode
.idea/
.env
.env
cover.out
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">

# Masjid's Droid
# Masjid's Droid v2.0.10

<img src="./assets/img/fares___blueprint.png" width="512" alt="M-Droid Blueprint"/>

Expand Down
14 changes: 14 additions & 0 deletions assets/masjids_data/Chomedey Laval QC/@ccil_kbw/info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Centre Culturel Islamique de Laval Khalid Bin Walid"
address: "1330 Antonio, Laval QC"
website: "https://ccil-kbw.com/"
social: # not used yet, need to discuss about these
- platform: "facebook"
url: "https://www.facebook.com/exampleurlidk"
- platform: "instagram"
url: "https://www.instagram.com/exampleurlidk/"
- platform: "youtube"
url: "https://www.youtube.com/@ccil-kbw"
coordinates:
latitude: 45.547559
longitude: -73.7568045
contributed_by: "@ccil_kbw"
7 changes: 6 additions & 1 deletion cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"fmt"
iqamav2 "github.com/ccil-kbw/robot/pkg/iqama/v2"
"github.com/ccil-kbw/robot/pkg/masjid_info"
"os"
)

Expand All @@ -11,7 +12,11 @@ func main() {
fmt.Println("Usage: iqamacli <@masjid>, e.g: iqamacli @ccil_kbw")
os.Exit(1)
}
client := iqamav2.NewIqamaCSV(os.Args[1])
masjidFolderRoot := os.Args[1]
client := iqamav2.NewIqamaCSV(masjidFolderRoot)

fmt.Println(client.GetShellPrettified())

masjidInfo := masjid_info.GetMasjidInfoFromFile(masjidFolderRoot)
fmt.Println(masjidInfo)
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require (
go.uber.org/zap v1.27.0
golang.org/x/oauth2 v0.18.0
google.golang.org/api v0.169.0
gopkg.in/yaml.v2 v2.4.0
gorm.io/driver/sqlite v1.5.5
gorm.io/gorm v1.25.7
)
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
3 changes: 3 additions & 0 deletions internal/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package version

const RobotVersion = "v2.0.10"
15 changes: 11 additions & 4 deletions pkg/discord/mappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@ package discord
import (
"github.com/bwmarrin/discordgo"
"github.com/ccil-kbw/robot/pkg/iqama/v2"
"github.com/ccil-kbw/robot/pkg/masjid_info"
"go.uber.org/zap"
)

func iqamaDiscordInteraction(logger *zap.Logger, resp v2.IqamaDailyTimes) *discordgo.InteractionResponseData {
func iqamaDiscordInteraction(logger *zap.Logger, resp v2.IqamaDailyTimes, respMasjidInfo masjid_info.MasjidInfo) *discordgo.InteractionResponseData {
logger.Info("iqamaDiscordInteraction", zap.Time("Date", resp.Date))
return &discordgo.InteractionResponseData{
Embeds: []*discordgo.MessageEmbed{
{
URL: "https://ccil-kbw.com/iqama",
URL: respMasjidInfo.Website,
Type: discordgo.EmbedTypeRich,
Title: "Iqama Time",
Description: "Iqama pulled from https://ccil-kbw.com/iqama",
Title: "Iqama Times for " + respMasjidInfo.Name + " on " + resp.Date.Format("2006-01-02"),
Description: "Contributed By " + respMasjidInfo.ContributedBy,
Color: 0x05993e,
Image: &discordgo.MessageEmbedImage{
// This is a test URL
URL: "https://cdn.discordapp.com/attachments/1159517401809952828/1232860492180099162/fares____bedouins_in_desert_discussing_night_cold_snow_far_away_4e47cde4-6cfa-423a-b966-9921d252e668.png?ex=6638d60e&is=6637848e&hm=99fe7744a0c41e7abe4b858eedd07c6a0d26eab652c9ce0fbef262704d41d620&",
Width: 300,
Height: 300,
},
Fields: func() []*discordgo.MessageEmbedField {
return []*discordgo.MessageEmbedField{
{
Expand Down
9 changes: 7 additions & 2 deletions pkg/discord/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package discord
import (
"github.com/bwmarrin/discordgo"
iqamav2 "github.com/ccil-kbw/robot/pkg/iqama/v2"
"github.com/ccil-kbw/robot/pkg/masjid_info"
"go.uber.org/zap"
"os"
"strings"
Expand All @@ -26,10 +27,14 @@ var (
choice := cityName + "/" + masjidName
iqamaClient := iqamav2.NewIqamaCSV(choice)
resp, _ := iqamaClient.GetTodayTimes()
_ = s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
respMasjidInfo := masjid_info.GetMasjidInfoFromFile(choice)
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: iqamaDiscordInteraction(logger, *resp),
Data: iqamaDiscordInteraction(logger, *resp, respMasjidInfo),
})
if err != nil {
logger.Error("Error responding to interaction", zap.String("GuildID", i.GuildID), zap.Error(err))
}
},
}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "Centre Culturel Islamique de Laval Khalid Bin Walid"
address: "1330 Antonio, Laval QC"
website: "https://ccil-kbw.com/"
coordinates:
latitude: 45.547559
longitude: -73.7568045
contributed_by: "@ccil_kbw"
Loading

0 comments on commit be5682b

Please sign in to comment.